I wanted to write a select query to fetch all the records but I am getting error if I try to match more than one type against a array type column, for example Below query is working
SELECT * FROM Car where ("Ford") IN UNNEST (cartype)
But this query is failing
SELECT * FROM Car where (["Ford","Honda","Suzuki"]) IN UNNEST (cartype)
HTTPError 400: {"code":3, "message":"First argument to IN UNNEST of type ARRAY does not support equality comparison [at 1:42]\
I have tried this on my end i got the same error when i tried with below query
SELECT * FROM Car where (["Ford","Honda","Suzuki"]) IN UNNEST (cartype)
Instead of the ARRAY\_INCLUDES function as answered by @Knut Olav Løite you can use the below query as well.
SELECT * FROM Car where (cartype) IN UNNEST (["Ford","Honda","Suzuki"])
In above I have changed the query where comparing the array column cartype with an array literal (["Ford","Honda","Suzuki"])
UNNEST operator converts an array to a table. Here cartype is a table column in which these UNNEST values may appear.
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