Skip to content
Advertisement

Order by multiple columns not working as expected

I have this sql :

The result is :

Expected result :

But I want to order and by month not only by year. I tried like this ORDER BY dc.year DESC, dc.month ASC, d. user_id ASC, but not working as expected because I want to liste each user order by year desc and by month asc. Can you help me please ?

Advertisement

Answer

Looks like you don’t need user_id in the ORDER BY clause.

Try this:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement