例如,我有一个表,其中包含 和 等geography
列children
。childrens
我需要计算每个有多少country
。
我只能做这样的事情:
SELECT geography, COUNT( * )
FROM table1
GROUP BY children
ORDER BY geography
好吧,我有例如:
Canada John
Canada John
Canada Peter
我需要结果,例如来自 Canada 有 2 children
。
但如果我会这样做group by children
,结果是:
Canada 2
Canada 1
如果group by geography
那时,
Canada 3