本帖最后由 504385214 于 2017-7-4 15:07 编辑
SELECT MZ_HJSFB.cfys as 医生编码,
B_RYBM.RYXM as 医生姓名,
金额 = sum(MZ_HJSFB.je) ,
B_ZY_FYZL.MC as 费用大类名称,
mz_hjsfb.fylx as 费用编码
FROM MZ_HJSFB,
B_RYBM,
B_ZY_FYXL ,
b_zy_fyzl
WHERE ( B_ZY_FYXL.BH = MZ_HJSFB.fylx ) and
( B_ZY_FYZL.BH = B_ZY_FYXL.FYZL ) and
( MZ_HJSFB.cfys = B_RYBM.RYBM ) and
( ( MZ_HJSFB.zdrq >= ? ) AND
( MZ_HJSFB.zdrq <= ? ) AND
( MZ_HJSFB.zfbj = '0' ) and
( MZ_HJSFB.mzzybj like ?) AND
( MZ_HJSFB.cfys like ? ) AND
( MZ_HJSFB.zfbj = '0' ) AND
( MZ_HJSFB.bmbm like ? )
)
GROUP BY
MZ_HJSFB.cfys ,
B_RYBM.RYXM ,
MZ_HJSFB.fylx ,
B_ZY_FYXL.MC ,
B_ZY_FYZL.MC
ORDER BY MZ_HJSFB.cfys ASC,
B_RYBM.RYXM ASC,
MZ_HJSFB.fylx ASC,
B_ZY_FYXL.MC ASC,
B_ZY_FYZL.MC ASC
|