karma_machine Posted August 23, 2003 Share Posted August 23, 2003 i was wondering if there was a query that i could put in to sort thing first by name then by number. Example George 21 Jim 18 Bob 21 Bill 16 George 12 and have this result Bill 16 Bob 21 George 12 George 21 Jim 18 Quote Link to comment https://forums.phpfreaks.com/topic/934-mysql-help/ Share on other sites More sharing options...
PHPcadet Posted August 23, 2003 Share Posted August 23, 2003 With MySQL you can specify more than one column in the ORDER BY clause in your SELECT statement as in: SELECT * FROM mytable ORDER BY name, number You can even sort each column differently as in SELECT * FROM mytable ORDER BY name ASC, number DESC would give you : Bill 16 Bob 21 George 21 George 12 Jim 18 Quote Link to comment https://forums.phpfreaks.com/topic/934-mysql-help/#findComment-3148 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.