SQL语句之按in排序

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 as varchar(10)))+',',',1,5,3,')

MySQL:
select * From 表 Where id in (1,5,3) order by instr(',1,5,3,',',CONCAT(',',id,','))

原文地址:https://www.cnblogs.com/hateyoucode/p/1628857.html