首页 > 代码库 > SQL排序问题

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 * FROM13 (Select TOP 200000 * From Job Where  jobno not like [0-9]% order by Jobno desc) A14 UNION ALL15 SELECT * FROM 16 (Select TOP 200000 * From Job Where  jobno like [0-9]% order by ID desc) B

 

SQL排序问题