I'm working in one scenario where I need to display few records from the table in which id does not exist in the list.
SELECT * FROM contract
WHERE `id` NOT IN (
CASE
WHEN type = 1 THEN '159,154'
WHEN type = 2 THEN ''
WHEN type = 3 THEN ''
END
)
ORDER BY id DESC
Over here you can see that if contract type = 1 then the result should not display 159 & 154 records from the table. But 154 number record is also coming in the result which should not.
Any help appreciated!