select * from table where id in(10,6,9,20)
这样的话 出来的数据是 根据id升序排的
请教下 怎么根据 in() 里的顺序的倒序来排
就是
20
9
6
10
这样排
作用就是 记录文章的浏览历史
后台
asp
access数据库
------解决方案--------------------
- SQL code
select * from table where id in(10,6,9,20)order by charindex(',' + cast(id as nvarchar(20)) + ',' ,',10,6,9,20,') desc
------解决方案--------------------
access里用instr函数,
- SQL code
select * from table where id in(10,6,9,20)order by Instr("10,6,9,20",","+cstr(id)) desc