Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 16 Sep 2005 @ 13:17:39 GMT


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


Subj:   Compare rows of tableA to rows of tableB - HOW?
 
From:   Al MacGowan

Good Morning Everyone..

I have a question that may not have the answer I'm looking for. The age-old question - I have TableA and TableB, they have an identical set of columns (C1, C2, C3). I want to identify the rows in TableA that are different than the rows in TableB.

I had an experienced Teradata programmer once tell me "oh that's easy, i'll just join the tables and do one-row minus the other row, and the changes will just come through the query". What does that mean? Has anyone else heard of such a concept?

In my experience, I would do a two-step compare. I'd Left Join TableA to TableB, joining on all columns one-at-a-time, with a WHERE stating that the ID of TableB IS NULL. Then the opposite, Right Join TableA to TableB where the ID of TableA IS NULL. That way, I can provide two reports (because chances are they will have to be treated separately to work on the data anyway).

Is there a more efficient way to do this? I've already made it a little more efficient by querying dbc.tables/columns joined to itself to generate my "join conditions" dynamically for me to not have to type. Is there something else that can be done?


Thanks!

Alistair MacGowan
Senior Database Administrator



     
  <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