Hi I'm not sure why it produce different result. could someone let me know what is my mistake?
this query return 2 rows of records
SELECT Prod.bintProductRef FROM Prod_ProfileTbl Prod
WHERE Prod.intDepartmentRef =4
bintProductRef
--------------------
164475
164476
and this query return 1 row of record
SELECT Prod.bintProductRef FROM Prod_ProfileTbl Prod
WHERE intCatRef = 132
bintProductRef
--------------------
164475
NOT EXISTS, when combine the above 2 queries, it should return 164476, but there is no ouput.
SELECT Prod.bintProductRef FROM Prod_ProfileTbl Prod
WHERE Prod.intDepartmentRef =4
AND NOT EXISTS (
SELECT Prod.bintProductRef FROM Prod_ProfileTbl Prod
WHERE intCatRef = 132)
NOT IN, this return 1 row of data , which is 164476 and this is correct.
SELECT Prod.bintProductRef FROM Prod_ProfileTbl Prod
WHERE Prod.intDepartmentRef =4
AND Prod.bintProductRef NOT IN (
SELECT Prod.bintProductRef FROM Prod_ProfileTbl Prod
WHERE intCatRef = 132)