SELECT those not found in IN() list
In case anyone stumbles upon this question and is wondering how to do this in PostgreSQL
VALUES (1),(79),(14),(100),(123) EXCEPT ALL SELECT "CustomerId" from "Customers";
You can use a derived table or temporary table for example to hold the list of CustomerId
then find the non matching ones with EXCEPT
.
The below uses a table value constructor as a derived table (compatible with SQL Server 2008+)
SELECT CustomerId
FROM (VALUES(1),
(79),
(14),
(100),
(123)) V(CustomerId)
EXCEPT
SELECT CustomerId
FROM Customers