Skip to main content
February 26, 2024
Question

MariaDB not in issue

  • February 26, 2024
  • 6 replies
  • 0 views

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`);

    6 replies

    stefanhelzle0001
    February 26, 2024

    Hard to say without knowing any details about your data.

    tim.clarke
    February 26, 2024

    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)

    February 26, 2024

    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;

    rupaa0642Author
    February 27, 2024

    Thank you. resolved

    February 27, 2024

    Fine! Please verify the answers to close this thread.

    harshitb6843
    February 27, 2024

    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.