首页 >数据库 >mysql教程 >让sql语句不排序,按照in语句的顺序返回结果

让sql语句不排序,按照in语句的顺序返回结果

WBOY
WBOY原创
2016-06-07 16:38:521412浏览

mysql: SELECT * FROM EVENT WHERE eventId IN(443,419,431,440,420,414,509) ORDER BY INSTR(',443,419,431,440,420,414,509,',CONCAT(',',eventId,',')) oracle: SELECT NAME FROM order WHERE oderid IN (111,222,333,444,555,666) ORDER BY INSTR('111,2

mysql:

SELECT * FROM EVENT WHERE eventId IN(443,419,431,440,420,414,509)  ORDER BY INSTR(',443,419,431,440,420,414,509,',CONCAT(',',eventId,','))

oracle:

SELECT NAME FROM order WHERE oderid IN (111,222,333,444,555,666) ORDER BY INSTR('111,222,333,444,555,666',orderid)
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn