janglijagga Posted March 2, 2010 Share Posted March 2, 2010 I have a small question. I have a mysql table where I store Width & Length of my items in four fields: Feet1, Inch1, Feet2, Inch2. Now I have to pull out records in ascending order in the priority-order of Feet1, Inch1, Feet2, Inch2. Something like this example: (Width x Length) 1' x 2' 1' x 2' 6" 1' x 3' 1' 6" x 2' 1' 6" x 2' 6" 2 x 1' 2' x 1' 6" 2' 6" x 1' My query is something like this: mysql_query("SELECT * FROM tblname ORDER BY Feet1+0, Inch1+0, Feet2+0, Inch2+0"); Sorry, I'm not too well versed in mysql. Please help. Quote Link to comment https://forums.phpfreaks.com/topic/193853-correct-order-for-sizes-in-mysql-feet-inches/ Share on other sites More sharing options...
harristweed Posted March 2, 2010 Share Posted March 2, 2010 mysql_query("SELECT * FROM tblname ORDER BY Feet1 DESC, Inch1 DESC, Feet2 DESC, Inch2 DESC"); Quote Link to comment https://forums.phpfreaks.com/topic/193853-correct-order-for-sizes-in-mysql-feet-inches/#findComment-1020365 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.