我一直在努力让这个SQL
查询生效。它适用于Access,但不适用MySQL
给我错误
#1064 - 您的SQL语法出错;
任何人都可以看到我的错误吗? Not In
是不允许的?
我的第一个查询是
SELECT departments.personName FROM departments WHERE departments.departmentName='HR';
然后将其嵌入到下一个查询
中SELECT DISTINCT allstaff.personName FROM allstaff
WHERE allstaff.personName Not In
(SELECT departments.personName FROM departments WHERE departments.departmentName='HR';);
答案 0 :(得分:1)
在您的查询结束时,将;);
替换为);
答案 1 :(得分:1)
请删除分号(;)
试试这个
SELECT DISTINCT allstaff.personName FROM allstaff
WHERE allstaff.personName Not In
(SELECT departments.personName FROM departments WHERE departments.departmentName='HR');