Presto array contains an element that likes some pattern
Use presto's array functions:
filter()
, which returns elements that satisfy the given conditioncardinality()
, which returns the size of an array:
Like this:
where cardinality(filter(myArray, x -> x like '%denied%')) > 0
In newer versions of PrestoSQL (now known as Trino), you can use the any_match
function:
WHERE any_match(column, e -> e like '%denied%')