TRI0N Posted February 22, 2007 Share Posted February 22, 2007 Okay I looked at the MySQL manuel for this and tried to sort some info by two keys.. $result4 = mysql_query("SELECT * FROM leaderboard WHERE (eventid = '$eventid') ORDER BY rounds_comp ASC, ORDER BY gross_score ASC LIMIT 10") ; I bet it something so simple and dumb that I'll get hit in the head from behind. MySQL site says to seperate them by a , but that doesn't seem to do the trick at all and neither do just a space. Link to comment https://forums.phpfreaks.com/topic/39611-solved-multi-order-by-query/ Share on other sites More sharing options...
CrazeD Posted February 22, 2007 Share Posted February 22, 2007 Try this: $result4 = 'SELECT * FROM leaderboard WHERE eventid ORDER BY rounds_comp ASC, ORDER BY gross_score ASC LIMIT 10'; Link to comment https://forums.phpfreaks.com/topic/39611-solved-multi-order-by-query/#findComment-191150 Share on other sites More sharing options...
TRI0N Posted February 22, 2007 Author Share Posted February 22, 2007 Nope that didn't do the trick.. Bummage... Link to comment https://forums.phpfreaks.com/topic/39611-solved-multi-order-by-query/#findComment-191179 Share on other sites More sharing options...
monk.e.boy Posted February 22, 2007 Share Posted February 22, 2007 Try this: $result4 = 'SELECT * FROM leaderboard WHERE eventid ORDER BY rounds_comp ASC, gross_score ASC LIMIT 10'; Link to comment https://forums.phpfreaks.com/topic/39611-solved-multi-order-by-query/#findComment-191213 Share on other sites More sharing options...
monk.e.boy Posted February 22, 2007 Share Posted February 22, 2007 $result4 = 'SELECT * FROM leaderboard WHERE eventid ORDER BY rounds_comp ASC, gross_score ASC LIMIT 10'; Oooops, does the 'WHERE evenid' bit work, should this read: SELECT * FROM leaderboard WHERE eventid=1 ORDER BY rounds_comp ASC, gross_score ASC LIMIT 10 monk.e.boy Link to comment https://forums.phpfreaks.com/topic/39611-solved-multi-order-by-query/#findComment-191214 Share on other sites More sharing options...
TRI0N Posted February 22, 2007 Author Share Posted February 22, 2007 Okay figured it out.. The correct format is: $result4 = mysql_query("SELECT * FROM leaderboard WHERE eventid = '$eventid' ORDER BY rounds_comp DESC, gross_score ASC LIMIT 10") ; Link to comment https://forums.phpfreaks.com/topic/39611-solved-multi-order-by-query/#findComment-191246 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.