[Solved] SQL – can we combine AND operator and NOT IN?


Whether or not this is possible depends on the database server you use. Some databases (eg PostgreSQL) support row values, which allow you to do this:

where (x, y) in (select colX, colY from ....)

Otherwise you can do something like

where exists (select 1 from ... where colX = x and colY = y)

solved SQL – can we combine AND operator and NOT IN?