Skip to content
Advertisement

Find unmatched rows between two tables

Given this setup:

How can I find missing combinations of (column1, column2) between these two tables? Rows not matched in the other table.

The desired result for the given example would be:

There can be duplicate entries so we’d want to omit those.

Advertisement

Answer

One method is union all:

If there are duplicates within a table, you can remove them by using select distinct. There is no danger of duplicates between the tables.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement