I have a product table, where data is a jsonb field.
The JSON inside looks like this:
{
id: 1,
name: "Paper",
locations: [
{locationId: 111, x: 1, y:1},
{locationId: 210, x: 27, y:86},
{locationId: 140, x: 34, y:134},
]
}
I have a query that returns the product where at least one location id matches a given id.
SELECT id FROM product WHERE product.data ->'locations' @> '[{"locationId: GIVEN_ID}]'
Now here's the question:I want to adapt the query for a GIVEN_ID_LIST to that I get all product where at least one locationId is in GIVEN_ID_LIST.