Select * from [guestbook] where guest_id in(5,10,2,3) order by (case when id=5 then 0 case when id=10 then 1case when id=2 then 2case when id=3 then 3 end)或Select * from [guestbook] where guest_id =5 union allSelect * from [guestbook] where guest_id=10Select * from [guestbook] where guest_id=2Select * from ...
--MS SQL用charindex/patindexSelect * from [guestbook] where guest_id in(5,10,2,3) order by patindex('%,'+rtrim(guest_id) +',%',','+@s+',' ) ascMS SQL 通常是这样用:declare @s nva...