zampu Posted June 10, 2007 Share Posted June 10, 2007 Hello i need an mysql query to rank the results, like SELECT field FROM table and to order them greatest to least by the value of a different field. Any help is greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/54915-mysql-results-ordering-them/ Share on other sites More sharing options...
soycharliente Posted June 10, 2007 Share Posted June 10, 2007 You're looking for ORDER BY. You can also sort ascending or descending. <?php $query1 = "SELECT field FROM table ORDER BY another_field ASC"; $query2 = "SELECT field FROM table ORDER BY another_field DESC"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/54915-mysql-results-ordering-them/#findComment-271612 Share on other sites More sharing options...
zampu Posted June 10, 2007 Author Share Posted June 10, 2007 Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/54915-mysql-results-ordering-them/#findComment-271621 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.