create view vi_cust_tenant as (
SELECT LB.ID                         AS PROJECT_ID,
       LC.ID                         AS CONTRACT_ID,
       CUST.CUSTOMERID               AS CUSTOMERID,
       CUST.CUSTOMERNAME             AS CUSTOMERNAME,
       CUST.CUSTOMERTYPE             AS CUSTOMERTYPE,
       CUST.CERTTYPE                 AS CERTTYPE,
       CUST.CERTID                   AS CERTID,
       CUST.SEX                      AS SEX,
       CUST.MOBILE                   AS MOBILE,
       CUST.LICENSENAME              AS LICENSENAME,
       CUST.LICENSENAMENAME          AS LICENSENAMENAME,
       CUST.WORKCORP                 AS WORKCORP,
       CUST.WORKADD                  AS WORKADD,
       CUST.WORKTEL                  AS WORKTEL,
       CUST.ENTRYTIME                AS ENTRYTIME,
       CUST.MAILING_ADDRESS          AS MAILING_ADDRESS,
       CUST.NATIVEPLACE              AS NATIVEPLACE,
       CUST.EMERGENCY_CONTACT_PERSON AS EMERGENCY_CONTACT_PERSON,
       CUST.EMPLOYRECORD             AS EMPLOYRECORD,
       CUST.EMERGENCY_CONTACT_TEL    AS EMERGENCY_CONTACT_TEL,
       CUST.INTRO                    AS INTRO,
       CUST.EDUDEGREE                AS EDUDEGREE,
       CUST.REMARK                   AS REMARK,
       CUST.MARRIAGE                 AS MARRIAGE,
       CUST.MARRIAGENAME             AS MARRIAGENAME,
       CUST.POPULATION               AS POPULATION,
       CUST.CHILDRENS_NUMBER         AS CHILDRENS_NUMBER,
       CUST.TELEPHONE                AS TELEPHONE,
       CUST.EDUEXPERIENCE            AS EDUEXPERIENCE,
       CUST.EDUEXPERIENCENAME        AS EDUEXPERIENCENAME,
       CUST.PROPERTY_TYPE            AS PROPERTY_TYPE,
       CUST.PROPERTY_TYPENAME        AS PROPERTY_TYPENAME,
       CUST.UNIT_NATURE              AS UNIT_NATURE,
       CUST.UNIT_NATURENAME          AS UNIT_NATURENAME,
       CUST.OCCUPATION               AS OCCUPATION,
       CUST.MAIN_INCOME              AS MAIN_INCOME,
       CUST.MAIN_INCOMENAME          AS MAIN_INCOMENAME,
       CUST.BEFORE_UNIT_NAME         AS BEFORE_UNIT_NAME,
       CUST.FAMILYMONTHINCOME        AS FAMILYMONTHINCOME,
       CUST.OTHER_INCOME             AS OTHER_INCOME,
       CUST.FULLADDRESS              AS FULLADDRESS,
       CUST.CUSTTYPE                 AS CUSTTYPE,
       CUST.CUSTTYPENAME             AS CUSTTYPENAME,
       CUST.PARTNER_NAME             AS PARTNER_NAME,
       CUST.PARTNER_ASSURE_RELATION  AS PARTNER_ASSURE_RELATION,
       CUST.PARTNER_CERTID           AS PARTNER_CERTID,
       CUST.PARTNER_SEX              AS PARTNER_SEX,
       CUST.PARTNER_TEL              AS PARTNER_TEL,
       CUST.PARTNER_SHUKOU           AS PARTNER_SHUKOU,
       CUST.PARTNER_SUNAME           AS PARTNER_SUNAME,
       CUST.PARTNER_SUPHONE          AS PARTNER_SUPHONE,
       CUST.PARTNER_SPOSITION        AS PARTNER_SPOSITION,
       CUST.PARTNER_SMINCOME         AS PARTNER_SMINCOME,
       CUST.PARTNER_WORKUNIT         AS PARTNER_WORKUNIT,
       CUST.SPOUSE_NAME              AS SPOUSE_NAME,
       CUST.SPOUSE_CERTID            AS SPOUSE_CERTID,
       CUST.SPOUSE_SEX               AS SPOUSE_SEX,
       CUST.SPOUSE_TEL               AS SPOUSE_TEL,
       CUST.SPOUSE_PARTNER           AS SPOUSE_PARTNER,
       CUST.SPOUSE_SHUKOU            AS SPOUSE_SHUKOU,
       CUST.SPOUSE_SHUKOUNAME        AS SPOUSE_SHUKOUNAME,
       CUST.SPOUSE_SUNAME            AS SPOUSE_SUNAME,
       CUST.SPOUSE_SUPHONE           AS SPOUSE_SUPHONE,
       CUST.SPOUSE_SPOSITION         AS SPOUSE_SPOSITION,
       CUST.SPOUSE_SMINCOME          AS SPOUSE_SMINCOME,
       CUST.SPOUSE_WORKUNIT          AS SPOUSE_WORKUNIT,
       LU.INPUTTIME                  AS INPUTTIME
FROM (((APZL.LB_PROJECT_INFO LB LEFT JOIN APZL.LB_CONTRACT_INFO LC ON ((convert(LC.PROJECT_ID USING UTF8) = LB.ID))) LEFT JOIN APZL.LB_UNION_LESSEE LU ON ((convert(LU.PROJECT_ID USING UTF8) = LB.ID)))
LEFT JOIN APZL.VI_CUST_PERSON CUST ON ((CUST.CUSTOMERID = LU.CUSTOMER_ID)))
WHERE (NOT (exists(
        SELECT 1 FROM APZL.CUST_PERSON_HIS PHIS WHERE ((PHIS.CUSTTYPE = 'cust_type.cust') AND (convert(PHIS.PROJECT_ID USING UTF8) = LB.ID)))))
ORDER BY LU.INPUTTIME);

-- comment on column vi_cust_tenant.project_id not supported: 标识

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

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

-- comment on column vi_cust_tenant.customername not supported: 客户名称

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

-- comment on column vi_cust_tenant.certtype not supported: 证件类型

-- comment on column vi_cust_tenant.certid not supported: 证件号

-- comment on column vi_cust_tenant.sex not supported: 性别

-- comment on column vi_cust_tenant.mobile not supported: 手机号

-- comment on column vi_cust_tenant.LICENSENAME not supported: 驾驶证姓名

-- comment on column vi_cust_tenant.WORKCORP not supported: 单位名称

-- comment on column vi_cust_tenant.WORKADD not supported: 单位地址

-- comment on column vi_cust_tenant.WORKTEL not supported: 单位电话

-- comment on column vi_cust_tenant.ENTRYTIME not supported: 入职时间

-- comment on column vi_cust_tenant.Mailing_Address not supported: 邮寄地址

-- comment on column vi_cust_tenant.NATIVEPLACE not supported: 户籍地址

-- comment on column vi_cust_tenant.EMERGENCY_CONTACT_PERSON not supported: 紧急联系人

-- comment on column vi_cust_tenant.EMPLOYRECORD not supported: 工作履历

-- comment on column vi_cust_tenant.EMERGENCY_CONTACT_TEL not supported: 紧急联系电话

-- comment on column vi_cust_tenant.INTRO not supported: 个人情况简介

-- comment on column vi_cust_tenant.EDUDEGREE not supported: 最高学位

-- comment on column vi_cust_tenant.REMARK not supported: 备注

-- comment on column vi_cust_tenant.MARRIAGE not supported: 婚姻状况

-- comment on column vi_cust_tenant.POPULATION not supported: 家庭人口数

-- comment on column vi_cust_tenant.childrens_number not supported: 子女人数

-- comment on column vi_cust_tenant.telephone not supported: 固定电话

-- comment on column vi_cust_tenant.EDUEXPERIENCE not supported: 最高学历

-- comment on column vi_cust_tenant.Property_type not supported: 房产类型

-- comment on column vi_cust_tenant.Unit_nature not supported: 单位性质

-- comment on column vi_cust_tenant.OCCUPATION not supported: 职业

-- comment on column vi_cust_tenant.main_income not supported: 主要收入

-- comment on column vi_cust_tenant.before_unit_name not supported: 前工作单位名称

-- comment on column vi_cust_tenant.FAMILYMONTHINCOME not supported: 家庭月收入

-- comment on column vi_cust_tenant.other_income not supported: 其他收入

-- comment on column vi_cust_tenant.fulladdress not supported: 地址全名

-- comment on column vi_cust_tenant.custtype not supported: 客户类别

-- comment on column vi_cust_tenant.Partner_name not supported: 姓名

-- comment on column vi_cust_tenant.Partner_ASSURE_RELATION not supported: 关系

-- comment on column vi_cust_tenant.Partner_certid not supported: 证件号码

-- comment on column vi_cust_tenant.Partner_SEX not supported: 性别

-- comment on column vi_cust_tenant.Partner_tel not supported: 联系电话

-- comment on column vi_cust_tenant.Partner_shukou not supported: 户口-配偶

-- comment on column vi_cust_tenant.Partner_suname not supported: 单位名称-配偶

-- comment on column vi_cust_tenant.Partner_suphone not supported: 单位电话-配偶

-- comment on column vi_cust_tenant.Partner_sposition not supported: 职位—配偶

-- comment on column vi_cust_tenant.Partner_smincome not supported: 月收入——配偶

-- comment on column vi_cust_tenant.Partner_workunit not supported: 工作单位

-- comment on column vi_cust_tenant.SPOUSE_name not supported: 姓名

-- comment on column vi_cust_tenant.SPOUSE_certid not supported: 证件号码

-- comment on column vi_cust_tenant.SPOUSE_SEX not supported: 性别

-- comment on column vi_cust_tenant.SPOUSE_tel not supported: 联系电话

-- comment on column vi_cust_tenant.SPOUSE_Partner not supported: 是否共同申请人

-- comment on column vi_cust_tenant.SPOUSE_shukou not supported: 户口-配偶

-- comment on column vi_cust_tenant.SPOUSE_suname not supported: 单位名称-配偶

-- comment on column vi_cust_tenant.SPOUSE_suphone not supported: 单位电话-配偶

-- comment on column vi_cust_tenant.SPOUSE_sposition not supported: 职位—配偶

-- comment on column vi_cust_tenant.SPOUSE_smincome not supported: 月收入——配偶

-- comment on column vi_cust_tenant.SPOUSE_workunit not supported: 工作单位

-- comment on column vi_cust_tenant.inputtime not supported: 登记时间

