Home >Backend Development >PHP Tutorial >mysql 按id in()排序的有关问题

mysql 按id in()排序的有关问题

WBOY
WBOYOriginal
2016-06-13 10:47:021013browse

mysql 按id in()排序的问题,
比如 查询条件为 where id in(456,213,64,17.79) 怎么按括号里数字的顺序对sql结果进行排列呢?



------解决方案--------------------
如果括号里数字刚好是从大到小。就用 #1 就可以。如果没有规律则用:
 where id in(456,213,64,17.79) order by find_in_set(id,'456,213,64,17.79')

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