Sql Query that somehow converts months to 4 seasons

sqlsql server

I need to write a query in sql server that let's me get get month registered in my table and somehow covert those months into 4 seasons(autumn,fall,spring,summer). Does anyone know how to make this done??

Best Answer

One method is a case. Your question doesn't clarify the logic, but here is an example:

(case when month(date) in (12, 1, 2) then 'winter'
      when month(date) in (3, 4, 5) then 'spring'
      when month(date) in (6, 7, 8) then 'summer'
      when month(date) in (9, 10, 11) then 'autumn'
 end) as season