mysql按几个组排序

时间:2017-05-09 08:58:05

标签: mysql sorting sql-order-by

如何首先按

排序mysql查询
(`superVip` DESC, `editDate` DESC) then (`vip` DESC, `editDate` DESC) (other ads sort by ID)

类似这样的事情

SELECT * 
FROM `ads` 
ORDER BY (`superVip` DESC, `editDate` DESC), (`vip` DESC, `editDate` DESC), `id` DESC

1 个答案:

答案 0 :(得分:0)

只是sintax的问题​​,看:

SELECT * FROM ads ORDER BY superVip DESC, editDate DESC, vip DESC, editDate DESC, id DESC