如果只是一条数据行,可以这样:
1
SELECT * FROM user ORDER BY user_id <> 7, score DESC;
主要是user_id <> 7
,会把用户id为7的排在前面。
如果是多条数据行:
1
SELECT * FROM user ORDER BY user_id NOT IN (7, 8, 9), score DESC;
如果只是一条数据行,可以这样:
1
SELECT * FROM user ORDER BY user_id <> 7, score DESC;
主要是user_id <> 7
,会把用户id为7的排在前面。
如果是多条数据行:
1
SELECT * FROM user ORDER BY user_id NOT IN (7, 8, 9), score DESC;
A new version of content is available.