はい。 CASE
でパーティショニングを行います クレース。
SELECT
COUNT(*),
CASE
WHEN age < 1 THEN 'age1'
WHEN age BETWEEN 1 AND 4 THEN 'age2'
WHEN age BETWEEN 4 AND 9 THEN 'age3'
ELSE 'age4'
END AS ageband
FROM children
GROUP BY ageband;
はい。 CASE
でパーティショニングを行います クレース。
SELECT
COUNT(*),
CASE
WHEN age < 1 THEN 'age1'
WHEN age BETWEEN 1 AND 4 THEN 'age2'
WHEN age BETWEEN 4 AND 9 THEN 'age3'
ELSE 'age4'
END AS ageband
FROM children
GROUP BY ageband;