-2

Im using SQL workbench connected to Redshift.

I wrote in my query EMail not like '%gmaii.co%' and for some reason NULLS are also being excluded.

Any idea on why its also excluding NULLS? I just want to exclude emails that have gmail.com.

  • 1
    If you are looking for gmail. Why does your SQL look for `gmaii`? – vol7ron Jun 11 '18 at 01:19
  • Possible duplicate of [Behaviour of NOT LIKE with NULL values](https://stackoverflow.com/questions/22818070/behaviour-of-not-like-with-null-values) –  Jun 11 '18 at 01:48
  • Useful resource https://stackoverflow.com/questions/17679721/why-does-postgresql-not-return-null-values-when-the-condition-is-true – smb Jun 11 '18 at 01:59

1 Answers1

3
Select * from table
where Email not like '%gmaii.co%' or email is null
Ian-Fogelman
  • 1,595
  • 1
  • 9
  • 15