我editng我原来的要求,因为我认为我已经困惑自己以及其他人。我想在大陆内做一些事件。很抱歉的混乱CASE声明COUNT
ID, --a unique incident number
case
when trim(both ' ' from cs.country) in ('France','UK',Germany) then 'Europe'
when trim(both ' ' from cs.country) in ('Argentina','Peru','Brazil')
then 'SouthAmerica'
when trim(both ' ' from cs.country) in ('Bangladesh,'India','China')
then 'Asia'
end as "Continent"
这是我希望看到
Continent Total
Europe 15
Asia 12
Asia 9
SouthAmerica 5
非常感谢
你说“COUNT在大陆上”。孟加拉国和印度都是亚洲国家,但数字不同,所以你的意思是按国家计数? – jarlh
对不起,我省略了一个重要的部分,我有一个'事件'列,每次发生事故时都会给出一个唯一的ID。所以我在计算每个大陆的事故数 – whitz11
那么孟加拉国和印度怎么有不同的数字呢?同一大陆... – jarlh