【子查询】使用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')