Mysql: put the specified data row in the front

If it's just a data row, you can do this:

 

SELECT * FROM user ORDER BY user_id<>7,score DESC;

 

Mainly "user_id<>7", the user id 7 will be ranked first.

 

If there are multiple data rows:

 

SELECT * FROM user ORDER BY user_id NOT IN(7,8,9),score DESC;

Guess you like

Origin blog.csdn.net/I_lost/article/details/109672961
Recommended