Reputation: 1687
I'm trying to use PostgreSQL to check if any values from a certain list are in any of the arrays stored in a database.
Something like:
SELECT * FROM table_name WHERE ('value1', 'value2', 'value3') = ANY(field_name);
field_name
is a VARCHAR(100)[]
Is this even possible?
Upvotes: 0
Views: 1121
Reputation:
As field_name
is an array, you can use the overlaps operator &&
:
SELECT *
FROM table_name
WHERE field_name && array['value1', 'value2', 'value3']::varchar[]
Upvotes: 4