I want 3 different columns cold days,hot days, and normal days
cold days => temperature less than 50 degrees hot days => temperature greater than 90 degrees normal days -> normal days => temperature between 50 -90 degrees
All these come from the same table and the only thing that changes the query is the where clause. How would I assign the where clause to each column??
This is what I have so far... but it doesn't seem right?
select temperatures.temp as "cold days",temperatures.temp as "hot days",temperatures.temp as "normal days" from temperatures where (temperature < 50) and (temperature > 90) and (temperature between 50 and 90)
SELECT CASE WHEN Temp < 50 THEN Temp ELSE NULL END AS ColdDays,
CASE WHEN Temp BETWEEN 50 AND 90 THEN Temp ELSE NULL END AS NormalDays,
CASE WHEN Temp > 90 THEN Temp ELSE NULL END AS HotDays