create or replace view V_country  as
select a.国家简称, b.金牌数,b.银牌数,b.铜牌数 from t_country a, 奖牌表 b where 
a.noc = b.noc
/

解决方案 »

  1.   

    select a.国家id,b.国家简称,sum(decode(b.type,'金牌',1,0)),
    sum(decode(b.type,'银牌',1,0)),sum(decode(b.type,'铜牌',1,0))
    from 奖牌表 a,国家表 b
    where a.国家id = b.国家id
    group by a.国家id,b.国家简称
      

  2.   

    我改成了
    select INF_C93.MEDAL_WINNER_NOC, COUNTRYLANG_CRSCLG.CNAME, 
    sum(decode(INF_C93.type,'GLD',1,0)),
    sum(decode(INF_C93.type,'SLV',1,0)),
    sum(decode(INF_C93.type,'BRN',1,0)) 
    from COUNTRYLANG_CRSCLG, INF_C93 
    where COUNTRYLANG_CRSCLG.CCOUNTRY_CLGCOU = INF_C93.MEDAL_WINNER_NOC 
    group by INF_C93.MEDAL_WINNER_NOC, COUNTRYLANG_CRSCLG.CNAME但所有得数都是0牙??
    decode什么意思亚??
      

  3.   

    decode的用法:
        用于进行判断:
        decode(id,1,'OK',2,"OK2",3,"OK3",OK8) 
        id是1,显示OK ,是2,显示OK2,是3,显示OK3,是其他数值,显示OK8.