mysql - Order one field both ASC and DESC -
i've got table events i'd show. want sort events in future ascending, , past in descending order. how can 1 query?
my current order
dec 23 nov 10 nov 04 sep 12 aug 01 jul 23
the order want
nov 4 ** changed place nov 10 dec 23 ** changed place sep 12 aug 01 jul 23
many in advance.
you asking sort distance current date:
select * table order if(date_field >= now()),0,1), abs(datediff(now(), date_field))
Comments
Post a Comment