New to SQL, would like to compare fields between a stg and src table. The identify any differences between the tables and assign transaction status of ‘C’ for change. Any new records will be set with ‘A’ for add.
STG_DM_CLIENT and SRC_DM_CLIENT
What is the best way to do it, would it be best to do a some form of union all. Unsure how to proceed, any assistance welcomed.
You can identify new records by using NOT IN or NOT EXISTS
Then, you can identify changed records by comparing fields: