摘要:
做网站的时候需要一个需求,需要按照指定的ID获取数据库中的数据,返回数据的顺序要和指定ID的顺序相同,数据库是SQL Server的,下面的代码是在网上找来的,SQL server的已经测试过,可以满足要求。Access:select * From 表 Where id in(1,5,3) order by instr(',1,5,3,',','&id&',')MSSQL:select * From 表 Where id in(1,5,3) order by charindex(','+rtrim(cast(id 阅读全文