Jela

唯风唯美

导航

公告

随笔分类(5)

随笔档案(9)

最新评论

统计

常用链接

阅读排行榜

评论排行榜

where id in 排序 按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,','))

posted on 2011-07-02 11:15 Jela 阅读(81) 评论(0) 编辑 收藏