I have two queries.
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:
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 FROMwhiteboard
where username='Gates'
and friend='Cur' at line 2
Hope my question is clear and any help would be helpful to me …..Thank You
Best Answer
MySQL does not support
EXCEPT
orMINUS
.You can use
NOT EXISTS
,OUTER JOIN ... NULL
orNOT IN
(be careful of NULLs) to do an anti semi join.See examples and performance comparisons here