mysql写法
- SELECT * FROM table WHERE id IN (6,5,1,4) ORDER BY FIELD(id,6,5,4,1);
- SELECT * FROM table WHERE id IN (6,5,1,4) ORDER BY INSTR(',6,5,1,4,',CONCAT(',',id,','));
复制代码
sqlite写法
- SELECT * FROM table WHERE id IN('6','5','1','4') ORDER BY INSTR('6,5,1,4',id);
复制代码
oracle写法
- SELECT * FROM table WHERE id IN (6,5,1,4) ORDER BY INSTR('6,5,1,4',id);
复制代码
sqlserver写法
- SELECT * FROM table WHERE id IN (6,5,1,4) ORDER BY CHARINDEX(','+ id +',', ',6,5,1,4,');
复制代码 |