Multiple level ordering Multiple level ordering sqlite sqlite

Multiple level ordering


You could use e.g. ORDER BY rating DESC, name ASC to sort by rating and then, if the ratings are equal, by name.


This query should do the trick:

SELECT * FROM (SELECT * FROM table ORDER BY rating DESC LIMIT 20) ORDER BY name