create view vi_lc_contract_rent_plan as (
SELECT ''                         AS CUSTOMERID,
       ''                         AS BANKCODE,
       ''                         AS ACC_NUMBER_TYPE,
       ''                         AS ACCOUNT_PROVINCE,
       ''                         AS ACCOUNT_CITY,
       ''                         AS ACCOUNT_TYPE,
       'RMB'                      AS COIN,
       ''                         AS PROTOCOL_NUMBER,
       ''                         AS PROTOCOL_CUST_NUMBER,
       ''                         AS CERT_TYPE,
       ''                         AS CERT_ID,
       ''                         AS MOBILE,
       ''                         AS CUSTOM_NUMBER,
       ''                         AS CLEARING_ACC_NUMBER,
       max(CRP.ID)                AS ID,
       max(CRP.CONTRACT_NUMBER)   AS CONTRACT_NUMBER,
       max(CRP.PRODUCT_ID)        AS PRODUCT_ID,
       max(CRP.PAYMENT_NUMBER)    AS PAYMENT_NUMBER,
       max(CRP.CUSTOMERNAME)      AS CUSTOMERNAME,
       max(CRP.LEASE_ACC_BANK)    AS LEASE_ACC_BANK,
       max(CRP.LEASE_ACC_NAME)    AS LEASE_ACC_NAME,
       max(CRP.LEASE_ACC_NUMBER)  AS LEASE_ACC_NUMBER,
       max(CRP.CLIENT_ACC_BANK)   AS BANK_NAME,
       max(CRP.CLIENT_ACC_NAME)   AS ACCOUNT,
       max(CRP.CLIENT_ACC_NUMBER) AS ACC_NUMBER,
       sum(CRP.PLAN_MONEY)        AS AMOUNT
FROM APZL.VI_LC_CON_RP_SECOND_ACCOUNT CRP
WHERE ((NOT (CRP.PAYMENT_NUMBER IN (
    SELECT APZL.LC_OCCUPY_RENT_LIST.PAYMENT_NUMBER
    FROM APZL.LC_OCCUPY_RENT_LIST
))) AND (str_to_date(CRP.PLAN_DATE, '%Y/%m/%d') < curdate()))
GROUP BY CRP.PAYMENT_NUMBER
ORDER BY CRP.PAYMENT_NUMBER DESC);

