就是系统原有的ksql如下:
SELECT
*
FROM
(SELECT
"VEHICLEINSURANCE".FID AS "ID",
"VEHICLEINSURANCE".FNumber AS "NUMBER",
"VEHICLEINSURANCE".FDate AS "DATE",
"PERSON".FName_l2 AS "PERSON.NAME",
"ENTERORGUNIT".FName_l2 AS "ENTERORGUNIT.NAME",
"CUSTOMER".FName_l2 AS "CUSTOMER.NAME",
"VEHICLE".FVIN AS "VEHICLE.VIN",
"VEHICLE".FPlateNum AS "VEHICLE.PLATENUM",
"VEHICLEINSURANCE".FInsurancedPerson AS "INSURANCEDPERSON",
"VEHICLEINSURANCE".FType AS "TYPE",
"INSUCOMPANY".FName_l2 AS "INSUCOMPANY.NAME",
"INSURANCESOURCEID".FName_l2 AS "INSURANCESOURCEID.NAME",
"VEHICLEINSURANCE".FInsuActualAmount AS "INSUACTUALAMOUNT",
"VEHICLEINSURANCE".FForcedSaleAmount AS "FORCEDSALEAMOUNT",
"VEHICLEINSURANCE".FBusinessSaleAmount AS "BUSINESSSALEAMOUNT",
"VEHICLEINSURANCE".FDiscountAmount AS "DISCOUNTAMOUNT",
"VEHICLEINSURANCE".FForcedNumber AS "FORCEDNUMBER",
"VEHICLEINSURANCE".FForcedAmount AS "FORCEDAMOUNT",
"VEHICLEINSURANCE".FVehVesTaxAmount AS "VEHVESTAXAMOUNT",
"VEHICLEINSURANCE".FBusinessNumber AS "BUSINESSNUMBER",
"VEHICLEINSURANCE".FBusinessAmount AS "BUSINESSAMOUNT",
"VEHICLEINSURANCE".FInsuTotallAmount AS "INSUTOTALLAMOUNT",
"VEHICLEINSURANCE".FTraffEffectDate AS "TRAFFEFFECTDATE",
"VEHICLEINSURANCE".FTraffInvalidDate AS "TRAFFINVALIDDATE",
"VEHICLEINSURANCE".FEffectDate AS "EFFECTDATE",
"VEHICLEINSURANCE".FInvalidDate AS "INVALIDDATE",
"VEHICLEINSURANCE".FIsInsuranceCheck AS "ISINSURANCECHECK",
"VEHICLEINSURANCE".FInsuranCheckDate AS "INSURANCHECKDATE",
"VEHICLEINSURANCE".FIsInsuranceSettle AS "ISINSURANCESETTLE",
"VEHICLEINSURANCE".FInsuranSettleDate AS "INSURANSETTLEDATE",
"VEHICLEINSURANCE".FInsuranceBillNumber AS "INSURANCEBILLNUMBER",
"VEHICLEINSURANCE".FInsuranceInvoiceNumber AS "INSURANCEINVOICENUMBER",
"VEHICLEINSURANCE".FIsCancelInsurance AS "ISCANCELINSURANCE",
"VEHICLEINSURANCE".FVehicleInsuranceType AS "VEHICLEINSURANCETYPE",
"SVEHICLEINSURANCE".FNumber AS "SVEHICLEINSURANCE.NUMBER",
"VEHICLEINSURANCE".FRemark AS "REMARK",
"VEHICLEINSURANCE".FCreateTime AS "CREATETIME",
"CREATOR".FName_l2 AS "CREATOR.NAME",
"VEHICLEINSURANCE".FStatus AS "STATUS",
"ORGUNIT".FName_l2 AS "ORGUNIT.NAME",
"BRAND".FName_l2 AS "BRAND.NAME",
"VEHICLEINSURANCE".FAutoSaleOrderNumber AS "AUTOSALEORDERNUMBER",
"LASTINSUCOMPANY".FName_l2 AS "LASTINSUCOMPANY.NAME",
"VEHICLE".FPlateNum AS "PLATENUM",
"VEHICLEINSURANCE".FReturnAmount AS "RETURNAMOUNT",
"VEHICLEINSURANCE".FInsuCompanyID AS "INSUCOMPANY.ID",
"VEHICLEINSURANCE".FVehicleID AS "VEHICLE.ID",
"VEHICLEINSURANCE".FAutoSaleOrderID AS "AUTOSALEORDERID",
"VEHICLEINSURANCE".FInsuranceType AS "INSURANCETYPE",
"AUDITOR".FName_l2 AS "AUDITOR.NAME",
"VEHICLEINSURANCE".FAuditTime AS "AUDITTIME",
"LASTUPDATEUSER".FName_l2 AS "LASTUPDATEUSER.NAME",
"VEHICLEINSURANCE".FLastUpdateTime AS "LASTUPDATETIME",
"VEHICLEINSURANCE".FEnterOrgUnitID AS "ENTERORGUNIT.ID",
"CURRENCY".FName_l2 AS "CURRENCY.NAME"
FROM T_ATS_VehicleInsurance AS "VEHICLEINSURANCE"
LEFT OUTER JOIN T_PM_User AS "AUDITOR"
ON "VEHICLEINSURANCE".FAuditorID = "AUDITOR".FID
LEFT OUTER JOIN T_PM_User AS "CREATOR"
ON "VEHICLEINSURANCE".FCreatorID = "CREATOR".FID
LEFT OUTER JOIN T_PM_User AS "LASTUPDATEUSER"
ON "VEHICLEINSURANCE".FLastUpdateUserID = "LASTUPDATEUSER".FID
LEFT OUTER JOIN T_PM_User AS "HANDLER"
ON "VEHICLEINSURANCE".FHandlerID = "HANDLER".FID
LEFT OUTER JOIN T_BD_Person AS "PERSON"
ON "VEHICLEINSURANCE".FPersonID = "PERSON".FID
LEFT OUTER JOIN T_ATS_Customer AS "CUSTOMER"
ON "VEHICLEINSURANCE".FCustomerID = "CUSTOMER".FID
LEFT OUTER JOIN T_ATS_Brand AS "BRAND"
ON "VEHICLEINSURANCE".FBrandID = "BRAND".FID
LEFT OUTER JOIN T_ATS_InsuranceCompany AS "INSUCOMPANY"
ON "VEHICLEINSURANCE".FInsuCompanyID = "INSUCOMPANY".FID
LEFT OUTER JOIN T_ATS_InsuranceCompany AS "LASTINSUCOMPANY"
ON "VEHICLEINSURANCE".FLastInsuCompanyID = "LASTINSUCOMPANY".FID
LEFT OUTER JOIN T_ATS_Vehicle AS "VEHICLE"
ON "VEHICLEINSURANCE".FVehicleID = "VEHICLE".FID
LEFT OUTER JOIN T_ATS_InsuranceSource AS "INSURANCESOURCEID"
ON "VEHICLEINSURANCE".FInsuranceSourceID = "INSURANCESOURCEID".FID
LEFT OUTER JOIN T_ORG_Sale AS "ORGUNIT"
ON "VEHICLEINSURANCE".FOrgUnitID = "ORGUNIT".FID
LEFT OUTER JOIN T_ATS_VehicleInsurance AS "SVEHICLEINSURANCE"
ON "VEHICLEINSURANCE".FSVehicleInsurance = "SVEHICLEINSURANCE".FID
LEFT OUTER JOIN T_ORG_Sale AS "ENTERORGUNIT"
ON "VEHICLEINSURANCE".FEnterOrgUnitID = "ENTERORGUNIT".FID
LEFT OUTER JOIN T_BD_Currency AS "CURRENCY"
ON "VEHICLEINSURANCE".FCurrencyID = "CURRENCY".FID) AS "VehicleInsuranceQuery"
推荐阅读