(SELECT IDOperatore FROM operatore) MINUS
(SELECT IDOperatore FROM commessaoperatore GROUP BY IDOperatore)
即使我尝试将MINUS
替换为EXCEPT
,此查询也无效。
单数查询SELECT IDOperatore FROM operatore
和SELECT IDOperatore FROM commessaoperatore GROUP BY IDOperatore
正在运行,但如果我尝试与Minus
运算符放在一起,则它们无效。
错误:#1064 - 您的SQL语法出错;查看与MySQL服务器版本对应的手册,以便在第1行“MINUS(SELECT IDOperatore FROM commessaoperatore GROUP BY IDOperatore)”附近使用正确的语法
答案 0 :(得分:3)
mysql中不存在MINUS
但是对于您的查询,您可以使用NOT EXISTS:
SELECT IDOperatore FROM operatore o
WHERE NOT EXISTS (SELECT 1
FROM commessaoperatore c
WHERE c.IDOperatore = o.IDOperatore)