我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