sql -- 利用order by 排名作弊

表结构:

需求:

方法1:union

select * from (select *  from user_level where id in (2,4,6) order by user_total desc ) a
union
(select * from (select *  from user_level where id not in (2,4,6) order by user_total desc ) b)

方法2:直接在order by加

select * from user_level order by id in (2,4,6) desc,user_total desc ;

posted @ 2019-07-12 10:56  花花妹子。  阅读(322)  评论(0编辑  收藏  举报