Kevin Nash
Kevin Nash

Reputation: 1561

Redshift - Filter multiple Not in condition

I am trying to build a query that filters out any email that has gmail or yahoo in the name. I tried the below:

select email from users where email not like ('@gmail.com','@yahoo.com')

I get an error

ERROR - operator does not exist: character varying

I am using Redshift DB. Thanks..

Upvotes: 0

Views: 2336

Answers (1)

AlexYes
AlexYes

Reputation: 4208

where email not like '%@gmail.com'
and email not like '%@yahoo.com'

there is no combination of a list with like, it works only for exact matches (in), and don't forget the wildcard (%)

if the list is larger there is another solution with a given answer (can look it up here if so)

Upvotes: 2

Related Questions