Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Wie bin ich willkürlich in MySQL?

SELECT CASE WHEN age BETWEEN 13 AND 17 THEN '13-17' 
            WHEN age BETWEEN 18 AND 25 THEN '18-25' 
            ELSE '26+' END AS AgeGroup,
    COUNT(*) AS total
FROM MyTable
GROUP BY AgeGroup