首页 > 技术文章 > SQL 把特定数据排在最前面

weimingxin 2017-12-09 17:30 原文

(1)
select * from table where name='D'
UNION ALL
select * from table where name<>'D' 

(2)

SELECT CASE WHEN [name]='D' THEN 0 ELSE 1 END FLAG,* FROM TABLE
order by flag asc

推荐阅读