I apologize if this question is vague, I'm new to SQL and am having some trouble. I'm trying to find the number of people within each weight group. Count that number and display the number of each class.
I think my issue lies within the THEN expression. Do I need to create a variable for each weight group to compare to?
Thank you
SELECT
(CASE WHEN pl_weight <180 THEN 1
WHEN pl_weight >=180 AND pl_weight <200 THEN 2
WHEN pl_weight >=200 AND pl_weight <220 THEN 3
ELSE 4 END),
count(1) "Less than 280", count(2)"180-200", count(3)"200-220",count(4)"More than 220"
FROM dl_player
GROUP BY (CASE WHEN pl_weight <180 THEN 1
WHEN pl_weight >=180 AND pl_weight <200 THEN 2
WHEN pl_weight >=200 AND pl_weight <220 THEN 3
ELSE 4
END));