I am looking to perform a query that returns a row if the array column type contains at least one entry from another array, so example:
Row1
col_a = {1,2}
I want to a query that says col_a contains {3,1}
and it should return Row1 because col_a contains '1'.
The value {3,1} in the example will come from another subquery. I am not sure this is possible, and I am struggling to find an example. The closest I found was the @>
operator but that requires all entries to be in col_a right rather than any matching?
You can use the &&
(overlap) operator
select array[1,2,3,4] && array[3,9];
?column?
----------
t
(1 row)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With