Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 09 Jan 2012 @ 09:25:23 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: Improving the performance of a minus query
 
From:   Kenneth Hansen

A Left Outer Join from the first table to the second table will, for the records you want, give you rows with values in the first columns and nulls in the second half.

Join criteria must cover all the columns of the PK and can also include the qualification on Coa_Crncy_id.

Give the tables an alias to make the sql easier/shorter

     SEL
      Atbl.Gl_Pst_Transaction_Typ_Cd
     ,Atbl.Gl_Pst_Source_Cd
     ,Atbl.Source_Cd
     [etc. to include all the required attbitutes] FROM
     PROD_INT_CORE_AUDIT.N0001_AGREEMENT_GL_POSTING atbl LEFT OUTER JOIN
     PROD_INT_SL_DIM_TARGET.N0001_AGMNT_GL_PST_DIM  btbl
     On   Atbl.PK [column1 of PK] = Btbl. [column1 of PK]
     And Atbl.PK [column2 of PK] = Btbl. [column2 of PK] [Etc to include all columns of the
     PK] And Atbl.Coa_Crncy_Id IN (1000000000104,1000000000124) Where Btbl.Coa_Crncy_id is NULL;

That assumes Coa_Crncy_id is never null - otherwise use another column that is never null.


Good luck,

Kenneth Hansen



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016