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

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

WBOY
Release: 2016-06-13 13:14:22
Original
977 people have browsed it

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')

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