I have to take many values from a table, which are written differently. Usually, I use ILIKE operator, but in my case, I think that it will take more time. Unfortunately, Redshift doesn't support LIKE IN operator. I will be very happy if somebody can give me a hint on solving this.
Asked
Active
Viewed 138 times
0
-
1Please provide some examples of what you want matched. – Gordon Linoff Dec 28 '19 at 16:00
-
[Is there a combination of “LIKE” and “IN” in SQL?](https://stackoverflow.com/questions/3014940/is-there-a-combination-of-like-and-in-in-sql/52264937) – Lukasz Szozda Dec 28 '19 at 16:00
1 Answers
3
Redshift supports regular expressions. So, if you wanted to look for "car", "train", or "boat" in a string, you can use:
where col ~ 'car|train|boat'
This would be equivalent to:
where col like '%car%' or
col like '%train%' or
col like '%boat%'

Gordon Linoff
- 1,242,037
- 58
- 646
- 786