ORDER BY DATE showing NULLS first then most recent dates

@Chris, you almost have it.

ORDER BY (CASE WHEN [Submission Date] IS NULL THEN 1 ELSE 0 END) DESC, 
         [Submission Date] DESC

[Edit: #Eppz asked me to tweak the code above as currently shown]

I personally prefer this a lot better than creating “magic numbers”. Magic numbers are almost always a problem waiting to happen.

Leave a Comment