SELECT * From Admin WHERE ID in (3,4,10,6)
查询结果:
Id Title
----------- ---------------
3 LFan
4 ZXin
6 YSXun
10 WWhua
想根据id顺序进行排序,显示成如下:
Id Title
----------- ---------------
3 LFan
4 ZXin
10 WWhua
6 YSXun
SELECT * From Admin WHERE ID in (3,4,10,6) order by charindex(cast(id as varchar),'3,4,10,6')