--药品零差率后医疗服务价格变动统计(耗材)--mwyy JCBB-20150731-001 select a.bh0000,a.xmmc00,a.xmgg00,a.xmdw00,a.sfje00 当前单价,b.sfje00 旧单价,sl 数量,(a.sfje00-b.sfje00)*sl 差额 from ( select bh0000,xmmc00,xmgg00,xmdw00,sfje00,sum(sl) sl from ( select b.bh0000,a.xmmc00,a.xmgg00,a.xmdw00,b.sfje00,a.xmsl00 sl from sf_fymx00 a,bm_yysfxm b where a.czrq00 between '20150701' and '20150731' and a.xmbh00=b.sfxmid and b.sfxmid<9999999996 and b.gjbm00 like '9%' union all select b.bh0000,a.xmmc00,a.xmgg00,a.xmdw00,b.sfje00,a.xmsl00 sl from zy_fymx00 a,bm_yysfxm b where a.czrq00 between '20150701' and '20150731' and a.xmbh00=b.sfxmid and b.sfxmid<9999999996 and b.gjbm00 like '9%') group by bh0000,xmmc00,xmgg00,xmdw00,sfje00) a,bm_yysfxm_20150630 b where a.bh0000=b.bh0000