對於航程(年,船),如何按標準SQL或MS-ACCESS中的年齡間隔對水手進行分組和計數?按年齡段劃分的組和計數
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
我試了一下:
SELECT YEAR, SHIP, SAILOR_AGE, COUNT (*) as `NUMBERS`
FROM TABLE
GROUP BY YEARS, SHIP, SAILOR_AGE;
它給我的水手每年數:
例子:
YEAR |SHIP |SAILOR_AGE | NUMBERS
------------------------------------------
2003 | Flying dolphin| 33 | 2
如何能集團水手年齡由intervalles
E xample:
From 20th to 40th year's old
From 40th to 60th year's old
你爲什麼不使用'CASE..WHEN'? – MusicLovingIndianGirl