Skip to content
Advertisement

Rows that are in table A but not in B

How can I check the rows for columns a, b, c, and d in table A but not in table B?

Advertisement

Answer

If you want to get full rows from table a you can use exists:

select *
from tbl_a
where not exists (
    select *
    from tbl_b
    where tbl_b.a = tbl_a.a
    and   tbl_b.b = tbl_a.b 
    and   tbl_b.c = tbl_a.c 
    and   tbl_b.d = tbl_a.d
)
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement