Skip to content
Advertisement

Sql Query with NOT LIKE IN WHERE CLAUSE

I have two tables emails and blockedSender I am trying to remove blocked sender from the email query. e.g.

emails table:

user_id from_address
1 name-1 <email-1@address.com>
2 name-2 <email-2@address.com>

blockedSender table:

blocked_address
email-1@address.com

Here I want to return all elements from the emails table where the from_address does not do a LIKE match with entries in the blocked address. Something similar to

which does not work because of incorrect syntax. Is there any way to do this?

Advertisement

Answer

You can express this using not exists

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement