我在我的数据库中触发查询,如下所示:
SELECT id, firmName, website FROM master_table WHERE
(firmName IS NULL OR firmName = '')
AND
(website IS NOT NULL OR website != '' );
我想要公司名称应为空的所有记录,相应的网站不应为空
但它仍会导致我可能遇到 NULL 或 EMPTY 网站的记录。
有人可以告诉我如何正确地做到这一点吗?
答案 0 :(得分:4)
SELECT id, firmName, website
FROM master_table
WHERE (firmName IS NULL OR firmName = '')
AND (website IS NOT NULL AND website != '' )
^---- and not or