Home  >  Article  >  Backend Development  >  mysql 排序

mysql 排序

WBOY
WBOYOriginal
2016-06-13 10:26:13708browse

mysql 排序求助

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->比如sql ="SELECT * FROM A WHERE `id` IN (5,18,25,4)"

现在的问题是怎么才能实现排序按照in数组(5,18,25,4)里的顺序来排序结果集?


------解决方案--------------------
... order by find_in_set(id, '5,18,25,4')
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