This is my query:
SELECT customer_email
FROM sales_flat_order
WHERE customer_email NOT IN (SELECT customer_email
FROM sales_flat_order
WHERE status != 'holded');
There are 3 rows with status holded
for my test customer_email
test@example.com, no other status for that mail. For some reason, the full query returns no matches. When I fill the NOT IN manually like that, it works, I get my 3 rows:
SELECT customer_email
FROM sales_flat_order
WHERE customer_email NOT IN ('whatever', 'foobar', '123@456.com');
So what am I doing wrong here?
Fiddle: https://dbfiddle.uk/?rdbms=mysql_5.6&fiddle=f990a09528d82d7bb4e72530a5de59ec
The fiddle works as expected though, my table is much bigger, but the columns are of the same type.
Thanks!
See Question&Answers more detail:os