You can also do something like this:
SELECT * FROM TableA LEFT JOIN TableB on TableA.X = TableB.X WHERE TableB.X IS NULL
(For a very simple example in your question, the NOT EXISTS
/ NOT IN
approach is probably preferable, but your real query is more complicated, this is an option that you might want to consider, for instace you need the som information from TableB, where there is a match, but also want to know where she is not)
source share