MYSQL实现如下:
select * from dbf
where id in(10,6,44,63,54,93,106,116,100,148,184,171,196,217,228)
order by charindex(','+rtrim(id)+ ',',',10,6,44,63,54,93,106,116,100,148,184,171,196,217,228,') 要在ORACEL上面怎么实现同样的功能,按in里的id号顺序查询结果请各大侠指点!谢谢!
select * from dbf
where id in(10,6,44,63,54,93,106,116,100,148,184,171,196,217,228)
order by charindex(','+rtrim(id)+ ',',',10,6,44,63,54,93,106,116,100,148,184,171,196,217,228,') 要在ORACEL上面怎么实现同样的功能,按in里的id号顺序查询结果请各大侠指点!谢谢!
SQL> select * from t1; ID NAME
---------- --------------------
1 tom
2 jack
3 lily
4 maySQL> select * from t1
2 where id in (2,3,1)
3 order by id; ID NAME
---------- --------------------
1 tom
2 jack
3 lilySQL> select * from t1
2 where id in (2,3,1)
3 order by decode(id,2,1,3,2,1,3); ID NAME
---------- --------------------
2 jack
3 lily
1 tom