I have the following table:
key | date | flag -------------------------- 1 now() true 2 now() - 1 hour true 3 now() + 1 hour tru
conditional order can be performed with CASE, like here:
CASE
select * from test order by flag , case when flag then date end desc , case when not flag then date end asc