MySQL WHERE x OR IS NULL无效

时间:2016-06-30 02:12:04

标签: mysql centos where mariadb isnull

select * from inventory.home_picture_types hpt
left join inventory.home_pictures hp on hp.home_picture_type_id = hpt.id
where hp.id IS NULL;

此查询适用于vagrant / homestead,并返回带有home_picture值的home_picture_types(正确,我只是想获取home_picture_types)。

但是,当我在CentOS Maria DB上运行此查询时,它根本不返回任何结果。它的好像 LEFT JOIN是一个INNER JOIN。

我用700种不同的方式编写了这个查询,没有任何帮助。我检查了sql_mode,它设置为'''在两个数据库上......任何想法为什么它在一个而不是另一个上工作?

1 个答案:

答案 0 :(得分:0)

所有类型:country

没有pic的类型:select DISTINCT home_picture_type_id from inventory.home_picture_types