0

尝试将表的数据插入到一个临时表中,然后从另一张表中再次插入到同一个临时表中

选择

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'/*

*/

- - - - - - - - - - - - - - - - - - - - - -第2步

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'
4

0 回答 0