Kryptix Posted December 17, 2009 Share Posted December 17, 2009 How would I order a SELECT by one column followed by another and another? So for example, I want to order them by their name first, then their age and then their DoB. I tried ORDER BY `name`, `age`, `DoB` but it doesn't give the results I'm expecting. Am I doing it right? Also, can you make say the name DESC, and then the age ASC separately? Link to comment https://forums.phpfreaks.com/topic/185425-order-by-more-than-one/ Share on other sites More sharing options...
ngreenwood6 Posted December 17, 2009 Share Posted December 17, 2009 should be: $query = "SELECT * FROM table WHERE something='something' ORDER BY name DESC, age ASC"; Link to comment https://forums.phpfreaks.com/topic/185425-order-by-more-than-one/#findComment-978873 Share on other sites More sharing options...
Kryptix Posted December 17, 2009 Author Share Posted December 17, 2009 Nice one, I was messing around with it and it clocked on just before you replied. Link to comment https://forums.phpfreaks.com/topic/185425-order-by-more-than-one/#findComment-978883 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.