Hi, I wanted to return the rows from cases table which are not in mail poller. But for somereason the following query is not giving me the expected result. Can someone help what mistake I am doing here.
SELECT * FROM `Cases` WHERE `fk_caseTypeRef_id` = 53 and case_id not in (SELECT fk_case_id FROM `MAIL_POLLER`);
Discussion posts and replies are publicly visible
Hard to say without knowing any details about your data.
Try this:
SELECT * FROM `Cases` c WHERE `fk_caseTypeRef_id` = 53 and not exists (select 'X' from `MAIL_POLLER` where fk_case_id = c.case_id)
you can also try this:-SELECT * FROM cases LEFT JOIN mail_poller ON cases.case_id = mail_poller.case_id WHERE mail_poller.case_id IS NULL;
Thank you. resolved
Fine! Please verify the answers to close this thread.
For these types of problems, the fastest way to identify the error is to use chatGPT. Try it when you face a problem next time. It works really well for such cases.