Home > Database > Mysql Tutorial > 让sql语句不排序,按照in语句的顺序返回结果

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

WBOY
Release: 2016-06-07 16:38:52
Original
1412 people have browsed it

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,','))
Copy after login

oracle:

SELECT NAME FROM order WHERE oderid IN (111,222,333,444,555,666) ORDER BY INSTR('111,222,333,444,555,666',orderid)
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template