mysql query for order base on current time
I just want to ask what would be the best query for sorting the time value.
ex. i have 5 records of time data type.
I want to sort the record base on the current time.
ex. if its already 9:00,
i want the out put to be :
is this possible? if so. what query would be the best approach?
thanks in advance. hope some one could answer my question.
CASE expression in the
ORDER BY clause.
SELECT * FROM `your_table_name` ORDER BY CASE WHEN `time_column` >= cast(now() as time) then 0 else 1 end, `time_column`;