create view vi_maindata_distributor_info as (
SELECT DI.ID              AS ID,
       DI.DISTRIBUTOR_NO  AS DISTRIBUTOR_NO,
       DI.ORGID           AS ORGID,
       OI.ORGNAME         AS ORGNAME,
       UI.USERNAME        AS USERNAME,
       DA.ACC_NUMBER      AS ACC_NUMBER,
       DDI1.CAUTION_MONEY AS SHOUKUAN,
       DDI2.CAUTION_MONEY AS TUIHUAN
FROM (((((APZL.DISTRIBUTOR_INFO DI LEFT JOIN APZL.DISTRIBUTOR_ACCOUNT DA ON ((DI.DISTRIBUTOR_NO = DA.DISTRIBUTOR_ID))) LEFT JOIN APZL.ORG_INFO OI ON ((DI.ORGID = OI.ORGID))) LEFT JOIN APZL.USER_INFO UI ON ((DI.ORGID = UI.BELONGORG))) LEFT JOIN APZL.D_DEPOSITCHARGE_INFO DDI1 ON (((DI.DISTRIBUTOR_NO = DDI1.DISTRIBUTOR_ID) AND (DDI1.MONEY_TYPE = '保证金收款'))))
LEFT JOIN APZL.D_DEPOSITCHARGE_INFO DDI2 ON (((DI.DISTRIBUTOR_NO = DDI2.DISTRIBUTOR_ID) AND (DDI2.MONEY_TYPE = '保证金退款')))));

-- comment on column vi_maindata_distributor_info.distributor_no not supported: 经销商编码

-- comment on column vi_maindata_distributor_info.orgid not supported: 部门编号

-- comment on column vi_maindata_distributor_info.orgname not supported: 机构名称

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

-- comment on column vi_maindata_distributor_info.acc_number not supported: 银行帐号

-- comment on column vi_maindata_distributor_info.shoukuan not supported: 保证金金额

-- comment on column vi_maindata_distributor_info.tuihuan not supported: 保证金金额

