rows not common in two tables

  • Hello

    I want to extract the rows that its key is not in both tables. The key in these tables in SSN. I want to get the records from table A where the SSN is not in table B and vice versa.

    Can anyone help me, I am sure that for an expert is super easy.

    thanks

  • SELECT ColumnA, ColumnB

    FROM TableX A

    WHERE NOT EXISTS( SELECT * FROM TableY B WHERE A.SSN = B.SSN)

    OR

    SELECT ColumnA, ColumnB

    FROM TableX A

    WHERE A.SSN NOT IN ( SELECT SSN FROM TableY)


    Kindest Regards,

  • Thanks! I worked perfectly.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply