使用NOT IN的Mysql给出空结果。也许是因为NULL值?

时间:2021-09-17 04:04:25

Hi I am having the following query:

嗨,我有以下查询:

SELECT *
FROM `workshopmails`
WHERE `workshopmails_mail` NOT
IN (

SELECT workshopklanten_email
FROM `workshopklanten`
)
GROUP BY workshopmails_mail
ORDER BY `workshopmails`.`workshopmails_datum` DESC

But although i know this should give a lot of results it gives the message:

但是,虽然我知道这应该会给出很多结果,但却给出了这样的信息:

MySQL returned an empty result set (0 rows).

I tried it with an older database and got 100+ results now with my newer data it wont work any more the only thing i can think of is because there are some NULL values in it, that where not in the older database

我尝试使用较旧的数据库,现在获得了100多个结果,我的新数据不再适用我唯一能想到的是因为它有一些NULL值,而不是旧数据库中的值

Does anyone know a solution so i can extract the emails?

有谁知道解决方案,所以我可以提取电子邮件?

Thx Matthy

1 个解决方案

#1


0  

Thanks to Martin Smith

感谢Martin Smith

NOT IN (SELECT workshopklanten_email FROM workshopklanten WHERE workshopklanten_email IS NOT NULL) 

would be one way.

将是一种方式。

SQL NOT IN not working

SQL NOT IN不工作

#1


0  

Thanks to Martin Smith

感谢Martin Smith

NOT IN (SELECT workshopklanten_email FROM workshopklanten WHERE workshopklanten_email IS NOT NULL) 

would be one way.

将是一种方式。

SQL NOT IN not working

SQL NOT IN不工作