Is it possible to order by multiple rows?
I want my users to be sorted by last_activity
, but at the same time, I want the users with pictures to appear before the ones without
Something like this:
SELECT some_cols
FROM `prefix_users`
WHERE (some conditions)
ORDER BY last_activity, pic_set DESC;
SELECT some_cols
FROM prefix_users
WHERE (some conditions)
ORDER BY pic_set DESC, last_activity;
Note that we can place
ASC
orDESC
after each column (like above does forpic_set
), or leave it to default (like above'slast_activity
-column).