【子查询】使用order by文章来源地址:https://www.yii666.com/article/756033.html
select * from (select top 100 percent * from table order by id) a
这时发现结果没有按id排序,需要将100 percent 改成 99.999 percent 或10000000(尽量大)文章地址https://www.yii666.com/article/756033.html网址:yii666.com
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')