The order of mysql queries in several ways

Can I order in several lines?

I want my users to be sorted by last_activity, but at the same time I want users with images to be displayed before those with

Something like that:

SELECT some_cols FROM `prefix_users` WHERE (some conditions) ORDER BY last_activity, pic_set DESC; 
+69
mysql sql-order-by
02 Feb 2018-11-11T00:
source share
3 answers
 SELECT some_cols FROM prefix_users WHERE (some conditions) ORDER BY pic_set DESC, last_activity; 
+105
Feb 02 2018-11-18T00:
source share

Sort by image and then by activity:

 SELECT some_cols FROM `prefix_users` WHERE (some conditions) ORDER BY pic_set, last_activity DESC; 
+9
Feb 02 2018-11-18T00:
source share
 SELECT id, user_id, video_name FROM sa_created_videos ORDER BY LENGTH(id) ASC, LENGTH(user_id) DESC 
-one
Aug 28 '17 at 10:31 on
source share



All Articles