减号运算符给我在mysql中的错误 [英] Minus operator giving me erros in mysql
问题描述
我有两个查询.
当我对它们使用减号运算符时,第一个查询返回11行,第二个查询返回6行,据我所知应该返回5行
First query returning 11 rows and second query returning 6 rows when i use the minus operator on them it should return 5 rows as far as my understanding
SELECT location from uploads where username='Gates'
MINUS
SELECT fileshare FROM `whiteboard` where username='Gates' and friend='Curlyclouds'
但是我遇到了以下错误:
But i am getting the following error:
您的SQL语法有错误;检查手册 对应于您的MySQL服务器版本以使用正确的语法 接近减去
whiteboard
的SELECT文件共享",其中username ='Gates' 和friend ='Cur'在第二行
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
希望我的问题很清楚,任何帮助都会对我有所帮助...谢谢
Hope my question is clear and any help would be helpful to me .....Thank You
推荐答案
MySQL不支持EXCEPT
或MINUS
.
MySQL does not support EXCEPT
or MINUS
.
您可以使用NOT EXISTS
,OUTER JOIN ... NULL
或NOT IN
(请注意NULL)进行反半联接.
You can use NOT EXISTS
, OUTER JOIN ... NULL
or NOT IN
(be careful of NULLs) to do an anti semi join.
这篇关于减号运算符给我在mysql中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!