9951 explained code solutions for 126 technologies


clickhouseSelect rows with any of specified values in array column


SELECT * FROM tbl3 WHERE hasAny(list, ['a', 'd'])ctrl + c
tbl3

table with array column in it

hasAny

will return true if specified array column has any of specified values in it

list

name of the array column

['a', 'd']

values to search in array column


Usage example

SELECT * FROM tbl3 WHERE hasAny(list, ['a', 'd'])
output
┌──────────────────ts─┬─list──────────┐
│ 2022-01-14 17:41:32 │ ['a','b','c'] │
│ 2022-01-14 17:41:38 │ ['b','c','d'] │
└─────────────────────┴───────────────┘