Du kan bruge case
:
SELECT (CASE WHEN plan_type LIKE 'silver%' THEN 'silver'
WHEN plan_type LIKE 'gold%' THEN 'gold'
WHEN plan_type LIKE 'platinum%' THEN 'platinum'
END) as plan_grp, COUNT(*)
FROM subscriptions
GROUP by (CASE WHEN plan_type LIKE 'silver%' THEN 'silver'
WHEN plan_type LIKE 'gold%' THEN 'gold'
WHEN plan_type LIKE 'platinum%' THEN 'platinum'
END);
Nogle databaser tillader dig at bruge et kolonnealias i GROUP BY
.