Skip to content
Advertisement

Selecting updated rows between two tables

Good day,

I have to identical table structures. One is base table and second has incremental changes. I wish to have resulting table so that I pick he rows from the update, if present. Otherwise from old table.

Like so

I tried selecting B table values on inner join and full outer join where a.key is NULL or b.key is NULL and union. (Code not tested to functionality yet.)

Is there an easier way to do this? I got the feeling that there has to be a more robust way to do this.

EDIT: I’m currently implementing this in the SPARK SQL context, but have had similar issues in the SQL server environment. Yet, I’m looking for a general idea.

Advertisement

Answer

From my understanding this would help

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement