For voyages (Years, ships), how can I group and count sailors by age intervalles in standard SQL?
YEAR SHIP SAILOR_AGE
2003 Flying dolphin 33
2003 Flying dolphin 33
2003 Flying dolphin 34
2001 Flying dolphin 23
2003 Flying dolphin 35
2001 Flying dolphin 38
2001 Flying dolphin 31
2003 Flying dolphin 36
2003 Columbine 41
2003 Columbine 42
2003 Flying dolphin 27
2003 Flying dolphin 51
2003 Flying dolphin 46
What I tried:
SELECT YEAR, SHIP, SAILOR_AGE, COUNT (*) as `NUMBERS`
FROM TABLE
GROUP BY YEARS, SHIP, SAILOR_AGE;
It give me the number of sailor for each year:
Example:
YEAR |SHIP |SAILOR_AGE | NUMBERS
------------------------------------------
2003 | Flying dolphin| 33 | 2
How Can group sailor ages by intervalles
Example:
From 20th to 40th year's old
From 40th to 60th year's old
Aucun commentaire:
Enregistrer un commentaire