发布于:2021-07-26 16:27:06
select a.deadid,a.shiftno,a.laydate,a.deadname,a.sex,a.age,a.deadcause,a.coldno,a.deadarea,a.deadrange,a.deadplace,a.arrivaltime,a.deadremark,a.inputdate,a.handler,a.handlerphone,
(select ifnull(sum(amount),0) as Expr1 FROM zq_by_charge as Charge01 where chargetype1 ="基本服务" and dead_id=a.deadid) AS chargebase,
(select ifnull(sum(amount),0) as Expr2 FROM zq_by_charge as Charge02 where chargetype1 ="丧葬用品" and dead_id=a.deadid) AS chargeused,
(select ifnull(sum(amount),0) as Expr3 FROM zq_by_charge as Charge03 where chargetype1 ="特需服务" and dead_id=a.deadid) AS chargespec,
(select ifnull(sum(amount),0) as Expr4 FROM zq_by_charge as Charge04 where chargetype1 ="其他服务" and dead_id=a.deadid) AS chargeother,
(select ifnull(sum(amount),0) as Expr5 FROM zq_by_charge as Charge05 where chargetype1 ="鲜花项目" and dead_id=a.deadid) AS chargeflower,
(select ifnull(sum(amount),0) as Expr6 FROM zq_by_charge as Charge06 where dead_id=a.deadid) AS amountsum,
(select ifnull(sum(reduce),0) as Expr7 FROM zq_by_charge as Charge07 where dead_id=a.deadid) AS reducesum,
(select ifnull(sum(jemoney),0) as Expr8 FROM zq_by_charge as Charge08 where dead_id=a.deadid) AS jemoneysum
from zq_by_deadinfo as a LEFT JOIN zq_by_service as b on a.deadid=b.dead_id limit 1,1
阅读 451+
10