create view vi_person_family as SELECT CI.CUSTOMERTYPE                                                                    AS CUSTOMERTYPE,
       LCI.ID                                                                             AS CONTRACT_ID,
       LCI.CONTRACT_NO                                                                    AS CONTRACT_NO,
       CI.CUSTOMERID                                                                      AS CUSTOMERID,
       (CASE WHEN (CI.CUSTOMERTYPE = '03') THEN CP.FULLNAME ELSE CF.NAME END)             AS CUSTOMERNAME,
       (CASE WHEN (CI.CUSTOMERTYPE = '03') THEN CP.MOBILE ELSE CF.TEL END)                AS PHONENUMBER,
       (CASE WHEN (CI.CUSTOMERTYPE = '03') THEN CP.CERTID ELSE CF.CERTID END)             AS CERTID,
       (CASE WHEN (CI.CUSTOMERTYPE = '03') THEN VMA.MAILING_ADDRESS ELSE CF.WORKUNIT END) AS ADDRESS
FROM ((((((APZL.LB_CONTRACT_INFO LCI LEFT JOIN APZL.LB_UNION_LESSEE LUL ON ((LUL.CONTRACT_ID = LCI.ID))) LEFT JOIN APZL.CUSTOMER_INFO CI ON ((CI.CUSTOMERID = LUL.CUSTOMER_ID))) LEFT JOIN APZL.CUSTOMER_PERSON CP ON ((CP.CUSTOMERID = CI.CUSTOMERID))) LEFT JOIN APZL.CUSTOMER_ACCOUNT CA ON ((CA.CUSTOMERID = CP.CUSTOMERID))) LEFT JOIN APZL.CUSTOMER_FAMILY CF ON (((CF.CONTRACT_ID = LCI.ID) AND (CF.PARTNER_ = 'Y'))))
LEFT JOIN APZL.VI_MAIL_ADDRESS VMA ON ((VMA.CUSTOMERID = CI.CUSTOMERID)))
WHERE ((LCI.CONTRACT_STATUS = '31') AND (LUL.IS_MAIN = 'Y'));

-- comment on column vi_person_family.customertype not supported: 客户类别

-- comment on column vi_person_family.contract_id not supported: 编号

-- comment on column vi_person_family.contract_no not supported: 合同号

-- comment on column vi_person_family.customerid not supported: 客户编号

