create view vi_maindata_proj_info as (
SELECT LPI.ID                  AS ID,
       LPI.PROJECT_NO          AS PROJECT_NO,
       LPI.PROJECT_NAME        AS PROJECT_NAME,
       CI.CUSTOMERID           AS CUSTOMERID,
       CI.CUSTOMERNAME         AS CUSTOMERNAME,
       CL1.ITEMNAME            AS ITEMNAME,
       UI.USERNAME             AS USERNAME,
       CP.FULLNAME             AS FULLNAME,
       CC.CERTID               AS CERTID,
       LGU.FULLNAME            AS GUAR,
       CF1.NAME                AS GONGTONG,
       CF2.NAME                AS PEIOU,
       LEC.MODEL               AS MODEL,
       LPC.PROJECT_PLAN_NUMBER AS PROJECT_PLAN_NUMBER,
       LPRP.PLAN_LIST          AS PLAN_LIST,
       LPFP.PLAN_MONEY         AS PLAN_MONEY,
       LPCF.FUND_OUT           AS FUND_OUT,
       CAT.ACCOUNT             AS ACCOUNT
FROM (((((((((((((((((APZL.LB_PROJECT_INFO LPI LEFT JOIN APZL.LB_UNION_LESSEE LUL ON (((LPI.ID = convert(LUL.PROJECT_ID USING UTF8)) AND
                                                                                       (LUL.IS_MAIN = 'Y') AND
                                                                                       ((LUL.CONTRACT_ID = '') OR isnull(LUL.CONTRACT_ID))))) LEFT JOIN APZL.CUSTOMER_INFO CI ON ((CI.CUSTOMERID = LUL.CUSTOMER_ID))) LEFT JOIN APZL.CUSTOMER_TYPE CT ON ((CI.CUSTOMERID = CT.CUSTOMERID))) LEFT JOIN APZL.CODE_LIBRARY CL1 ON (((CL1.ITEMNO = CT.CUSTTYPE) AND (CL1.CODENO = 'cust_type')))) LEFT JOIN APZL.CUSTOMER_ATTRIBUTION CA ON ((CI.CUSTOMERID = CA.CUSTOMERID))) LEFT JOIN APZL.USER_INFO UI ON ((CA.USERID = UI.USERID))) LEFT JOIN APZL.CUSTOMER_PERSON CP ON ((CI.CUSTOMERID = CP.CUSTOMERID))) LEFT JOIN APZL.CUSTOMER_CERT CC ON (((CI.CUSTOMERID = CC.CUSTOMERID) AND (CC.STATUS = 'valid')))) LEFT JOIN APZL.LB_GUARANTEE_UNIT LGU ON ((LGU.PROJECT_ID = LPI.ID))) LEFT JOIN APZL.CUSTOMER_FAMILY CF1 ON (((convert(CF1.PROJECT_ID USING UTF8) = LPI.ID) AND (CF1.SPOUSE_ <> 'Y')))) LEFT JOIN APZL.CUSTOMER_FAMILY CF2 ON (((convert(CF2.PROJECT_ID USING UTF8) = LPI.ID) AND (CF2.SPOUSE_ = 'Y')))) LEFT JOIN APZL.LB_EQUIPMENT_CAR LEC ON ((LEC.PROJECT_ID = LPI.ID))) LEFT JOIN APZL.LC_PROJ_CONDITION LPC ON ((convert(LPC.PROJECT_ID USING UTF8) = LPI.ID))) LEFT JOIN APZL.LC_PROJ_RENT_PLAN LPRP ON (((convert(LPRP.PROJECT_ID USING UTF8) = LPI.ID) AND (LPRP.PLAN_LIST = 1)))) LEFT JOIN APZL.LC_PROJ_FUND_PLAN LPFP ON (((convert(LPFP.PROJECT_ID USING UTF8) = LPI.ID) AND (LPFP.FEE_TYPE = 'feetype10')))) LEFT JOIN APZL.LC_PROJ_CASH_FLOW LPCF ON (((convert(LPCF.PROJECT_ID USING UTF8) = LPI.ID) AND (LPCF.FUND_OUT > 0))))
LEFT JOIN APZL.CUSTOMER_ACCOUNT CAT ON ((convert(CAT.PROJECT_ID USING UTF8) = LPI.ID))));

-- comment on column vi_maindata_proj_info.ID not supported: 标识

-- comment on column vi_maindata_proj_info.PROJECT_NO not supported: 项目编号

-- comment on column vi_maindata_proj_info.PROJECT_NAME not supported: 项目名称

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

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

-- comment on column vi_maindata_proj_info.username not supported: 用户姓名

-- comment on column vi_maindata_proj_info.FULLNAME not supported: 姓名

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

-- comment on column vi_maindata_proj_info.guar not supported: 担保人姓名

-- comment on column vi_maindata_proj_info.gongtong not supported: 姓名

-- comment on column vi_maindata_proj_info.peiou not supported: 姓名

-- comment on column vi_maindata_proj_info.model not supported: 型号/规格

-- comment on column vi_maindata_proj_info.PROJECT_PLAN_NUMBER not supported: 项目方案编号

-- comment on column vi_maindata_proj_info.plan_list not supported: 期次

-- comment on column vi_maindata_proj_info.PLAN_MONEY not supported: 计划金额

-- comment on column vi_maindata_proj_info.fund_out not supported: 流出量

-- comment on column vi_maindata_proj_info.account not supported: 帐户名称

