Here is my table:
id | is_quick_plus | is_quick | top_date | date
----|---------------|----------|------------|------------
1 | 1 | 0 | 2017-11-29 | 2017-11-01
2 | 0 | 1 | NULL | 2017-11-01
3 | 1 | 0 | NULL | 2017-11-02
4 | 0 | 1 | 2017-11-28 | 2017-11-01
5 | 0 | 0 | NULL | 2017-11-03
The current sort is (1,4,2,3,5)
1 and 4 have top_date other sort by date
when I sort by
is_quick_plus DESC, is_quick DESC, top_date DESC, date DESC
one row has no top_date going up because it has is_quick_plus but has expired .. and should sort by date ..
I just to first sort by is_quick_plus and top_date, then is_quick and top_date, then by date ... in 1 query
解决方案
I solved it by using a group BY in the ending of the select