--
这是sql,主合同代码是 as 新的名字
SELE。CT dbo.agreementBAndC.agreementCode AS id, dbo.agreementBAndC.agreementName AS 本合同名称, dbo.agreementBAndC.agreementPrice AS 本合同金额,
dbo.agreementBAndC.agreementPartyA AS 甲方代码, dbo.agreementBAndC.agreementPartyB AS 乙方代码, dbo.agreementBAndC.agreementType AS 合同类型,
dbo.agreementBAndC.agreementFatherCode AS 主合同代码, dbo.agreementBAndC.agreementEndPriceType AS 合同结算类型, dbo.agreementBAndC.agreementPayPrice AS 已付金额,
dbo.agreementBAndC.审核流程状态, dbo.agreementBAndC.bz, dbo.agreementBAndC.agreementDate AS 签订时间, flow_1.flowCode, flow_1.flowName, flow_1.flowMain, flow_1.flowPx, flow_1.isOver,
flow_1.flowMainCode, flow_1.flowLimitIds, dbo.agreement.agreementName AS 主合同名称, partner_1.partnerName AS 甲方名称, dbo.partner.partnerName AS 乙方名称,
dbo.agreementBAndC.录入人员代码, dbo.employee.employeeName, dbo.agreementBAndC.agreementFileMain, dbo.agreementBAndC.agreementFileName,
dbo.供应商合同结算.审核流程状态 AS 结算审核流程flowMainCode, dbo.供应商合同结算.结算金额, dbo.flow.flowName AS 结算审核流程flowName, dbo.flow.flowCode AS 结算审核流程flowCode,
dbo.flow.flowMain AS 结算审核流程flowMain, dbo.flow.flowLimitIds AS 结算审核流程flowLimitIds, dbo.flow.isOver AS 结算审核流程isOver, dbo.flow.flowPx AS 结算审核流程px,
dbo.agreementBAndC.合同内账科目代码, dbo.财务内账科目.科目名称, dbo.财务内账科目.本级路径完整名称, dbo.财务内账科目.父路径代码
FROM dbo.财务内账科目 RIGHT OUTER JOIN
dbo.agreementBAndC ON dbo.财务内账科目.科目代码 = dbo.agreementBAndC.合同内账科目代码 LEFT OUTER JOIN
dbo.flow RIGHT OUTER JOIN
dbo.供应商合同结算 ON dbo.flow.flowMainCode = dbo.供应商合同结算.审核流程状态 ON dbo.agreementBAndC.agreementCode = dbo.供应商合同结算.供应商合同代码 LEFT OUTER JOIN
dbo.employee ON dbo.agreementBAndC.录入人员代码 = dbo.employee.employeeSFId LEFT OUTER JOIN
dbo.flow AS flow_1 ON dbo.agreementBAndC.审核流程状态 = flow_1.flowMainCode LEFT OUTER JOIN
dbo.agreement ON dbo.agreementBAndC.agreementFatherCode = dbo.agreement.agreementCode LEFT OUTER JOIN
dbo.partner ON dbo.agreementBAndC.agreementPartyB = dbo.partner.partnerCode LEFT OUTER JOIN
dbo.partner AS partner_1 ON dbo.agreementBAndC.agreementPartyA = partner_1.partnerCode