select * from (select a.code,sum(b.usd_amt),sum(c.usd_amt),sum(c.usd_amt)/sum(b.usd_amt)
from cpcode a ,swjck b ,tssb_sc c   where a.code=b.cpcode and b.cpcode=c.cpcode  and c.sb_ym>='200501' and c.sb_ym<='200502' 
and c.zhsh_flag<>' ' group by a.code)tb1  
join 
 (select a.code,sum(b.mdtse),sum(d.mdse),sum(d.ytse), sum(d.mdtse)/sum(b.mdtse)
from cpcode a ,swjck b ,mdtsb_fb d  where a.code=b.cpcode    and left(d.sb_ym,4)=d.ss_year 
and d.cpcode=b.cpcode and d.sb_ym>='200501' and d.sb_ym<='200502'   and b.ym=d.sb_ym  group by a.code) tb2 on tb1.code=tb2.code 这样就没问题了啊!
但不知道是不是你要的结果!你最好是把表的结构和一些测试的数据贴出来!
这样才好帮你吗!!