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

mysql 排序的有关问题~

WBOY
Release: 2016-06-13 10:20:43
Original
885 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template