开发者

SQL query operator minus is not working

开发者 https://www.devze.com 2023-02-05 17:20 出处:网络
(SELECT IDOperatore FROM operatore) MINUS (SELECT IDOperatore FROM commessaoperatore GROUP BY IDOperatore)
(SELECT IDOperatore FROM operatore) MINUS 
(SELECT IDOperatore FROM commessaoperatore GROUP BY IDOperatore)  

This query is no working, even if I try to replace MINUS with EXCEPT. The singular query SELECT IDOperatore FROM operatore an开发者_如何学Pythond SELECT IDOperatore FROM commessaoperatore GROUP BY IDOperatore are working, but if I try to put together with Minus operator they don't work.

ERROR: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MINUS (SELECT IDOperatore FROM commessaoperatore GROUP BY IDOperatore)' at line 1


MINUS does not exists in mysql

however for you query you can use NOT EXISTS:

SELECT IDOperatore FROM operatore o
WHERE NOT EXISTS (SELECT 1
                 FROM commessaoperatore c 
                 WHERE c.IDOperatore = o.IDOperatore)
0

精彩评论

暂无评论...
验证码 换一张
取 消