sql -- 利用order by 排名做弊

表結構:spa

需求:code

方法1:unionblog

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加io

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

相關文章
相關標籤/搜索