apzl_leasing/src_sql/view/vi_overdue_rent_plan_sum.sql
2020-07-02 16:38:09 +08:00

19 lines
745 B
SQL

DELIMITER $$
ALTER ALGORITHM=UNDEFINED DEFINER=`apzl`@`%` SQL SECURITY DEFINER VIEW `vi_overdue_rent_plan_sum` AS
SELECT
`lc_overdue_rent_plan`.`CONTRACT_ID` AS `contract_id`,
COUNT(`lc_overdue_rent_plan`.`PLAN_LIST`) AS `over_list`,
MAX(`lc_overdue_rent_plan`.`Overdue_days`) AS `over_days`,
ROUND(SUM(`lc_overdue_rent_plan`.`overduerent`),2) AS `over_money`,
ROUND(SUM(`lc_overdue_rent_plan`.`penalty`),2) AS `over_penalty`,
ROUND(SUM(`lc_overdue_rent_plan`.`overinterest`),2) AS `over_interest`
FROM `apzl`.`lc_overdue_rent_plan`
WHERE (`lc_overdue_rent_plan`.`overduerent` > 0)
GROUP BY `lc_overdue_rent_plan`.`CONTRACT_ID`$$
DELIMITER ;
-- comment on column vi_overdue_rent_plan_sum.contract_id not supported: 合同编号