0

How can I filter the dates that it would sort first by today then normal?

I have a column with data type datetime, I wanted my results to be sorted showing today's date first and continue normal sorting.

  • 1
    What does "normal" sorting mean here? – G-Nugget Apr 28 '14 at 23:12
  • 1
    possible duplicate of [Sorting by date & time in descending order?](http://stackoverflow.com/questions/9511882/sorting-by-date-time-in-descending-order) –  Apr 28 '14 at 23:13
  • I mean descending order.. so the results would first show this day's values and then from the future to past results – Jay-ar Buño Apr 28 '14 at 23:18

1 Answers1

0

What about

SELECT
  ...
FROM 
  ...
ORDER BY IF(DATE(datefield=CURRENT_DATE()),0,1), datefield DESC

Edit

Added the DESC to the ORDER BY after the 3rd comment to the OQ

Eugen Rieck
  • 64,175
  • 10
  • 70
  • 92