Archives of the TeradataForum
Message Posted: Fri, 16 Sep 2005 @ 13:17:39 GMT
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?
|Copyright 2016 - All Rights Reserved|
|Last Modified: 23 Jun 2019|