select * from table where id in(10,6,9,20)
这样的话 出来的数据是 根据id升序排的请教下 怎么根据 in() 里的顺序的倒序来排就是
20
9
6
10
这样排
作用就是 记录文章的浏览历史
后台
asp
access数据库
这样的话 出来的数据是 根据id升序排的请教下 怎么根据 in() 里的顺序的倒序来排就是
20
9
6
10
这样排
作用就是 记录文章的浏览历史
后台
asp
access数据库
select *
from table
where id in(10,6,9,20)
order by id desc
order by charindex(',' + cast(id as nvarchar(20)) + ',' ,',10,6,9,20,') desc
貌似这样比较麻烦吧, LZ使用插入时间desc 排序是不是更好些?select *
from table
where id in(10,6,9,20)
order by insertdate desc --如果有插入时间的话。
order by charindex(',' + cast(id as varchar(50)) + ',' ,',10,6,9,20,') desc
where id in(10,6,9,20)
order by Instr("10,6,9,20",","+cstr(id)) desc