In Presto is there a way to do a like on an in statement

Viewed 17

In Presto how do i combine like in for example below.

select * from table where cloumn in like ('abc','xyz')
1 Answers

In SQL language, IN is the collection of OR conditions. Example, Col IN ('abc', 'xyz') is equal to (Col = 'abc' OR Col = 'xyz').

So, you can achieve this by

select * from table where column LIKE '%abc%' OR column LIKE '%xyz%' 

Or you can use the below one if the values are many and from different table.

SELECT T1.* FROM Table1 T1
INNER JOIN Table2 T2 ON T1.column Like '%' + T2.Value_column_to_match +'%'
Related