尝试将表的数据插入到一个临时表中并再次插入来自不同表的同一临时表
选择
sfb.SAP_SHIP_TO,sfb.SAP_SOLD_TO,sfb.INVOICE_DATE,fb.MATERIAL_GROUP,sfb.FUEL_GROUP,sfb.INTERFACE_STATUS,sfb.gross_flag,sfb.gross_qty,sfb.net_qty
into
#mda_temp_sap_fuel_bdocs
from
mda_agreement_site sas
join
sap_fuel_bdocs sfb
on
sas.sap__c = sfb.sap_ship_to
where
sfb.Interface_Status = 'SUMMED'/*
和
* /
Select
sfb.SAP_SHIP_TO,
sfb.SAP_SOLD_TO,
sfb.INVOICE_DATE,
sfb.MATERIAL_GROUP,
sfb.FUEL_GROUP,
sfb.INTERFACE_STATUS,
sfb.gross_flag,
sfb.gross_qty,
sfb.net_qty
into #mda_temp_sap_fuel_bdocs
from
mda_agreement_site sas
join
sap_fuel_bdocs_archive sfb
on
sas.sap__c = sfb.sap_ship_to
where
sfb.Interface_Status = 'SUMMED'