I'm having table which contains columns Id and Pcode. where ID column is foreign key. I'm trying to get the ID, which Pcode does not contains the value 'FT' with group by 'ID'.
the desired result is 3. the ID column 3 does not have the Pcode FT. Can anyone help me to write a query to get the desired result. Thanks in Advance.
One option would be to use aggregation:
SELECT ID FROM yourTable GROUP BY ID HAVING SUM(IIF(PCODE = 'FA', 1, 0)) = 0