欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

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

程序员文章站 2022-05-17 21:01:06
...
bitsCN.com

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)

bitsCN.com
相关标签: sql语句 mysql