curly_brackets
curly_brackets

Reputation: 5598

Order by rating, then by time created

I've made a simple service where you can post rows and other people can rate them.

I want it to be ordered by rating, as it is now, and then ordered by time created. This would result in ratings above 0 at the top. First of these will be the latest.

My SQL ends like this:

ORDER BY d.rating DESC,
d.created DESC

...But it does not give me the wanted result. What am I missing?

Upvotes: 0

Views: 59

Answers (1)

ajtrichards
ajtrichards

Reputation: 30565

You would use:

ORDER BY d.rating, d.created DESC

Upvotes: 1

Related Questions