I run a process that loads a table(tableA) and during this process I run function that does a check and if it doesn't pass my check I put it in a table(tableB) to be looked at by another department.
Now they have asked me if ALL records for an single ID get inserted into tableB and there are no records for that ID in tableA then they want to see all records in the program, which means I have to Insert into tableA(copy). So Im thinking Id run the whole process and check the tables after they end up where they do and run something like this
SELECT * FROM tableB WHERE ID NOT IN(SELECT ID FROM tableA);
If I get rows back then do the Insert. So Im wondering if there is a better way of accomplishing what I need or are there any other opinions on how they would do this? Should I use NOT EXISTS instead? Any tips would help me out