Query per età
Ecco come estrarre dati per fascie d’età
1select count(*) as iscritti, 2CASE 3WHEN ( YEAR(CURRENT_DATE)-YEAR(data))- ( RIGHT(CURRENT_DATE,5)< RIGHT(data,5) ) BETWEEN 14 AND 18 THEN "14-18" 4WHEN ( YEAR(CURRENT_DATE)-YEAR(data))- ( RIGHT(CURRENT_DATE,5)< RIGHT(data,5) ) BETWEEN 19 AND 25 THEN "19-25" 5ELSE "altro" 6END as fascia 7FROM tabella 8GROUP BY fascia
Tip precedente: Eventi settimana prossima
Tip successivo: Group by con ordine specificato

MySQL Report un tool di shell per tenere tutto sotto controllo