有一列国家代码和另外3列有MEDALS GOLD,SILVER和BRONZE 我想展示他们为每个国家获得的金牌,银牌和铜牌的总数,
图表看起来像这样
COUNTRY_ISOCODE PART_GOLD PART_SILVER PART_BRONZE
--------------- ---------- ----------- -----------
AUS 2 0 0
AUS 2 0 3
AUS 0 0 0
ZAF 0 0 0
ZAF 1 1 0
但我希望它像这样
COUNTRY_ISOCODE PART_GOLD PART_SILVER PART_BRONZE
--------------- ---------- ----------- -----------
AUS 4 0 0
ZAF 1 1 0
答案 0 :(得分:3)
假设您做谈论SQL(如count
和distinct
所暗示的那样):
select country_isocode,
sum(part_gold) as part_gold,
sum(part_silver) as part_silver,
sum(part_bronze) as part_bronze
from the_table
group by country_isocode;