Home > Backend Development > PHP Tutorial > mysql 排序的有关问题~

mysql 排序的有关问题~

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 13:32:54
Original
704 people have browsed it

mysql 排序的问题~~~~~~~
比如我有一个表:


我现在想要的效果是,status=1的排在最前面按create_time排序,status!=1的直接按create_time排序。
请各位大牛指点!~~~

------解决方案--------------------
select * from tt order by status=1 desc,create_time desc;

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
How to create abc.php file
From 1970-01-01 08:00:00
0
0
0
How to create python format text in win10
From 1970-01-01 08:00:00
0
0
0
How to create utf-8 files in python?
From 1970-01-01 08:00:00
0
0
0
Create a php file of specified size
From 1970-01-01 08:00:00
0
0
0
Create VUE UI component library
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