Search code examples
apache-sparkapache-spark-sqldremio

how to use Like any, like all in spark


I was trying to use like any and like all in this query in Spark/ Dremio SQL

SELECT * FROM table_name where col_name LIKE ANY (CONCAT('%', 10, '%'), CONCAT('%', 20, '%'), CONCAT('%', 12, '%'))
SELECT * FROM table_name where col_name LIKE ALL (CONCAT('%', 10, '%'), CONCAT('%', 20, '%'), CONCAT('%', 12, '%'))

it is. showing error :

Failure parsing the query.

BY USING any I want to select all the rows with either 10, 20 or 12values and by using all I was trying to get a value which has all 3 values in it. kindly help in resolving the query


Solution

  • SELECT * FROM table_name where col_name LIKE '%10%' AND col_name LIKE '%20%' AND col_name LIKE '%12%'
    
    SELECT * FROM table_name where col_name LIKE '%10%' OR col_name LIKE '%20%' OR col_name LIKE '%12%'