mysql sorting by 2 columns dependencies -
i'm searching trick, how sort this: have 2 columns: status (numeric) , modification_date (date).
if status<9 (means me if case not closed) - should "order status,modification_date
if status=9 (if case closed) - should sorted "order status,modification_date desc
so - if have cases not closed - should first in chronological order, if closed - should in reversed order (newest first)
i hoped, can union, it's not possible use "order by" in both sections (or maybe i'm doing wrong)
is possible do?
order status, if(status < 9, 1, -1) * modification_date
Comments
Post a Comment