Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想按 entry_date 降序对帖子进行排序。有些帖子可能处于活动状态,所以我想根据进入日期对活动帖子进行排序。
所以输出应该如下所示:
id post entry_date status 1 abc.. 15-april-2012 1 5 xyz 12-april-2012 1 2 art... 14-april-2012 0
如何排序?
试试下面:
SELECT * FROM tablename ORDER BY if(status=1,0,1), entry_date desc