hno Posted November 8, 2009 Share Posted November 8, 2009 I want to run a query that has two order by statment(order by star desc and order by random).I have a column in my table that is the number of stars that begin from 6 to 1 . I want to show all rows sorted by star and when for example the star=6 then show them random and after that show star=5 random.How can do so? thanks Quote Link to comment https://forums.phpfreaks.com/topic/180730-how-to-write-this-query/ Share on other sites More sharing options...
Alex Posted November 8, 2009 Share Posted November 8, 2009 SELECT * FROM table ORDER BY star DESC, RAND() Quote Link to comment https://forums.phpfreaks.com/topic/180730-how-to-write-this-query/#findComment-953513 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.