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

mysql 排序的有关问题~

WBOY
WBOYOriginal
2016-06-13 10:20:43947browse

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


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

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

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