MySQL NOT IN doesn't work
mysql, sql
Solution
As requested, my comment as an answer.
My brain said "case sensitive", my fingers added `IS NOT NULL` to the subquery automaticly. My smart fingers bypass NOT NULL problems in comparism :-).
Here is your working query:
SELECT e.* from emails AS e
WHERE e.error <> 1
AND UPPER(e.login) NOT IN
(SELECTUPPER(email_login) FROM accounts WHERE email_login IS NOT NULL)
my fingers added the UPPER() to that string comparism this time too.
Problem
I have this MySQL query: ``` select e.* from emails as e where e.error <> 1 AND e.login NOT IN ( select email_login from accounts ) ``` But it returns 0 rows. ``` select e.* from emails as e where e.error <> 1 AND e.id NOT IN (select email_id from accounts ) ``` Does work correctly. email_login is `varchar(255)` and id is `int(11)`.