【子查詢】使用order by
select * from (select top 100 percent * from table order by id) a
這時發現結果沒有按id排序,需要將100 percent 改成 99.999 percent 或10000000(盡量大)
select * from (select top 99.999 percent * from table order by id) a
或
select * from (select top 1000000 * from table order by id) a
【排序】 按in里內容排序
select * from table where id in ('xxxx') order by charindex(id,'xxxx')