我有兩個查詢。減號運算符在mysql中給我錯誤
首先查詢返回11行,第二個查詢返回6行,當我使用減號來對他們來說,應該儘量返回5行作爲我的理解
SELECT location from uploads where username='Gates'
MINUS
SELECT fileshare FROM `whiteboard` where username='Gates' and friend='Curlyclouds'
但我得到以下錯誤:
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 fileshare FROM
whiteboard
where username='Gates' and friend='Cur' at line 2
希望我的問題是明確的,任何幫助,將幫助我.....謝謝
我試過使用NOT EXITS代替零件 – user1529342
等價的'NOT EXISTS'查詢應該看起來像'SELECT位置從uploads u where username ='Gates'且不存在(SELECT * FROM whiteboard w where w.username ='蓋茨'和w.friend ='Curlyclouds'和w.fileshare = u.location)' –
嗨馬丁它工作.....非常感謝和歡呼 – user1529342