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,');