-- 收费业务分析 -- 收费数据分析 -- 收费金额 select t.car_park_name, case when sum(amount) is null then 0 else round(sum(amount)/100,2) end +30 as reality_amount, -- 应收金额 case when sum(amount) is null then 0 else round(sum(amount)/100,2) end as amount -- 实收金额 FROM luo_parking_information t left join (select a.park_id,a.pay_time,b.amount from luo_parking_chargerecord a inner join luo_parking_chargerecord_subject b on a.order_no=b.order_no) c ON t.id = c.park_id group by 1 HAVING sum(amount)>0