Reputation:
MySQL keeps throwing errors when I try to use the SQL except
in my query...
Why isn't it working? What's wrong with it?
select name, email from users
except
select name, email from users_ban
Upvotes: 4
Views: 45
Reputation: 44881
As far as I know MySQL does not support theexcept
statement. You can use query with a correlatednot exists
predicate to the same effect like this:
SELECT DISTINCT *
FROM users
WHERE NOT EXISTS (
SELECT 1
FROM users_ban
WHERE users.name
=
users_ban.name
AND users.email
=
users_ban.email );
Upvotes: 1