Reputation: 4098
I am trying to achieve and NOT operation and NAND operation in between Queries.
SELECT
country_name,country_code
from country
where not (country_name='Land islands' and country_code='AX');
Works well; Shows all other countries other than the two country which I am mentioning.
When I try with some select inside the where condition it shows errors.
SELECT * from
country
where not
(SELECT * from country
where country_name='Land islands'
and
SELECT * from country
where country_code='AX');
It shows an error..
Kindly refer the Link: With my previous question and the working of NOT and NAND operation.
MySQL NAND/NOR operations in Queries
Upvotes: 0
Views: 307
Reputation: 3821
AND
should be replaced by UNION
and the primary key
of table (let it assume id
) should be checked with NOT IN
clause.
SELECT * from country
WHERE id NOT IN
(SELECT id from country
where country_name='Land islands'
UNION
SELECT id from country
where country_code='AX'
);
Upvotes: 1