SQl CASE Statement

Something like..

ORDER BY 
  CASE 
    WHEN ISDATE(DateTime) = 1 THEN 
    CASE DateTime
       WHEN <= '2016-03-01' THEN 1   -- Preseason
       WHEN >= '2016-03-31' THEN 3   -- PostSeason
       ELSE 2 END                    -- Season
   ELSE 4 END,                       -- Not a date, figure out how to handle
  DateTime

Leave a Comment