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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:44:211540browse

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
Statement:
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