create view vi_customer_info as SELECT APZL.LB_GUARANTEE_UNIT_TEMP.CERTID     AS CERTID,
       APZL.LB_GUARANTEE_UNIT_TEMP.FULLNAME   AS NAME,
       APZL.LB_GUARANTEE_UNIT_TEMP.MOBILE     AS PHONE,
       'assuror'                              AS CUSTTYPE,
       '担保人'                                  AS TYPENAME,
       APZL.LB_GUARANTEE_UNIT_TEMP.FLOWUNID   AS FLOWUNID,
       APZL.LB_GUARANTEE_UNIT_TEMP.PROJECT_ID AS PROJECTID
FROM APZL.LB_GUARANTEE_UNIT_TEMP
WHERE (APZL.LB_GUARANTEE_UNIT_TEMP.CERTTYPE = 'Ind01')
UNION
SELECT CFT.CERTID      AS CERTID,
       CFT.NAME        AS NAME,
       CFT.TEL         AS PHONE,
       'unionlessee'   AS CUSTTYPE,
       '共同申请人'         AS TYPENAME,
       CFT.FLOWUNID    AS FLOWUNID,
       LULT.PROJECT_ID AS PROJECTID
FROM (APZL.CUSTOMER_FAMILY_TEMP CFT
LEFT JOIN APZL.LB_UNION_LESSEE_TEMP LULT ON ((CFT.FLOWUNID = LULT.FLOWUNID)))
WHERE (CFT.PARTNER_ = 'Y')
UNION
SELECT CPT.CERTID      AS CERTID,
       CPT.FULLNAME    AS NAME,
       CPT.MOBILE      AS PHONE,
       'lessee'        AS CUSTTYPE,
       '承租人'           AS TYPENAME,
       CPT.FLOWUNID    AS FLOWUNID,
       LULT.PROJECT_ID AS PROJECTID
FROM (APZL.CUSTOMER_PERSON_TEMP CPT
LEFT JOIN APZL.LB_UNION_LESSEE_TEMP LULT ON ((CPT.FLOWUNID = LULT.FLOWUNID)));

