Home > Database > Mysql Tutorial > mysql根据in中出现的先后顺序排序_MySQL

mysql根据in中出现的先后顺序排序_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:36:07
Original
809 people have browsed it

bitsCN.com

mysql根据in中出现的先后顺序排序

 

有的时候我们需要根据in的列表进行排序,而并且一般的升降序

   www.bitsCN.com  

Sql代码  

select * from user where user_id in (10084960310007011,10029627710007011,100000000001206373)  

 order by find_in_set(  

    user_id ,  

    '10084960310007011,10029627710007011,100000000001206373')  

 

 这样查询出来的数据第一个是10084960310007011,第二个是10029627710007011,第三个是100000000001206373

 

bitsCN.com
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
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template