I have a table of updates that I wish to compare against the a database to find those records with differences.
Each update record has a cat_id.
Some updates have an alt_cat_id.
I need a select to search to search if these differ, but only search for the alt-cat_id if it is populated. I don't have a solution for this but thought the IF statement might help.

Code:
SELECT upd.key, upd.cat_id, upd.alt_cat_id, db.cat_id
...