I have a table with the following fields: last_update, votes & uptime.
Now, how would you select all tables with last_update > 0 first and then it should select last_update = 0. Then sort everything on the amount of votes and finally, uptime.
last_update > 0 and last_update = 0 is really important, because it will put the server on top of the list, or at the bottom.
It should NOT sort last_update! Only sort if last_update > 0 and last_update = 0.
Currently I have:
SELECT * FROM servers ORDER BY votes DESC, last_update DESC, uptime_pct DESC
According with the SELECT syntax
[ORDER BY {col_name | expr | position} [ASC | DESC], ...]it’s possibile to have an expression syntax in order by.So your query is: