To produce the set of records only in Table A, but not in Table B

SELECT * FROM TableA A LEFT JOIN TableB B ON A.key = B.key WHERE B.key IS NULL
To produce the set of records only in Table A, but not in Table B, we perform the left (outer) join,
then exclude the records we don't want from the right side via a where clause

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.