首页新闻找找看学习计划

如何把 同名的合在一起?

0
悬赏园豆:10 [待解决问题]
select     
           GY_YGDM.YGXM as 医生姓名,
           SUM(CASE GY_SFXM.SFXM WHEN '1' THEN MS_SFMX.ZJJE ELSE 0 END) 西药,
           SUM(CASE GY_SFXM.SFXM WHEN '4' THEN MS_SFMX.ZJJE ELSE 0 END) 卫材费,
           SUM(CASE GY_SFXM.SFXM WHEN '5' THEN MS_SFMX.ZJJE ELSE 0 END) 挂号费,
           SUM(CASE GY_SFXM.SFXM WHEN '3' THEN MS_SFMX.ZJJE ELSE 0 END) 草药,
           SUM(CASE GY_SFXM.SFXM WHEN '2' THEN MS_SFMX.ZJJE ELSE 0 END) 成药, 
           SUM(CASE GY_SFXM.SFXM WHEN '19' THEN MS_SFMX.ZJJE ELSE 0 END) 诊查费,         
           SUM(CASE GY_SFXM.SFXM when '13' THEN MS_SFMX.ZJJE ELSE 0 END) 化验费,
           SUM(CASE GY_SFXM.SFXM WHEN '21' THEN MS_SFMX.ZJJE ELSE 0 END) 材料费,
           SUM(CASE GY_SFXM.SFXM WHEN '22' THEN MS_SFMX.ZJJE ELSE 0 END) 麻醉费,
           SUM(CASE GY_SFXM.SFXM WHEN '25' THEN MS_SFMX.ZJJE ELSE 0 END) 护理费,          
           SUM(CASE WHEN GY_SFXM.SFXM IN ('26' ,'12') THEN MS_SFMX.ZJJE ELSE 0 END) 放射费,
           SUM(CASE WHEN GY_SFXM.SFXM IN ('9' ,'15','20') THEN MS_SFMX.ZJJE ELSE 0 END) 检查费,
           SUM(CASE GY_SFXM.SFXM WHEN '24' THEN MS_SFMX.ZJJE ELSE 0 END) 手术费,
           SUM(CASE GY_SFXM.SFXM WHEN '7' THEN MS_SFMX.ZJJE ELSE 0 END) 床位费,
           SUM(CASE GY_SFXM.SFXM WHEN '10' THEN MS_SFMX.ZJJE ELSE 0 END) 超声费,
           SUM(CASE GY_SFXM.SFXM WHEN '16' THEN MS_SFMX.ZJJE ELSE 0 END) 心电图费,
           SUM(CASE WHEN GY_SFXM.SFXM IN ('11' ,'14','18','6' ) THEN MS_SFMX.ZJJE ELSE 0 END) 治疗费,
           SUM(CASE WHEN GY_SFXM.SFXM IN ('8' ,'17','23') THEN MS_SFMX.ZJJE ELSE 0 END) 其他费,
           SUM(MS_SFMX.ZJJE) 费用合计
           
           from 
                MS_GHMX
                inner join GY_YGDM
                on GY_YGDM.YGDM = MS_GHMX.YSDM
                inner join MS_MZXX
                on MS_MZXX.BRID = MS_GHMX.BRID    
                left join MS_SFMX
                on MS_SFMX.MZXH=MS_MZXX.MZXH
                left join GY_SFXM
                on GY_SFXM.SFXM=MS_SFMX.SFXM
                
                                            
            where            
                MS_GHMX.GHSJ >= '2015-01-01'--:开始时间    
                and MS_GHMX.GHSJ < '2015-01-25'--:结束时间
                      
         group BY GY_SFXM.SFXM,
                  GY_YGDM.ygxm

结果:

定位I搜索的主页 定位I搜索 | 初学一级 | 园豆:194
提问于:2015-01-27 21:22
< >
分享
所有回答(1)
0

group by GY_SFXM.SFXM, 收费项目? 为什么要有这个

爱编程的大叔 | 园豆:30206 (高人七级) | 2015-01-27 22:31

哦哦 !!!

      还真是的也?,,,,

谢谢                               

  爱编程的大叔                            

支持(0) 反对(0) 定位I搜索 | 园豆:194 (初学一级) | 2015-01-27 22:34
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册