SQL排序问题

 1 ''按多个字段排序
 2 Select * From Job order by job desc,id asc
 3 
 4 ''按首字符(非数字)排序
 5 Select * From Job order by case when isnumeric(left(jobno,1))=0
 6 Then left(jobno,1) end
 7 
 8 ''按首字符分组
 9 Select count(jobno) From Job group by left(jobno,1)
10 
11 ''合并Order by排序语句
12 SELECT * FROM
13 (Select TOP 200000 * From Job Where  jobno not like '[0-9]%' order by Jobno desc) A
14 UNION ALL
15 SELECT * FROM 
16 (Select TOP 200000 * From Job Where  jobno like '[0-9]%' order by ID desc) B

 

posted @ 2016-09-22 11:58  温故余学  阅读(12931)  评论(0编辑  收藏  举报