我有一列包含json / jsonb数据。数据库是postgresql。
列数据示例
{"postId": "p522","groupId": "g11",...}
{"postId": "p5ds","groupId": "g234",...}
{"postId": "p5cz","groupId": "g597",...}
我正在尝试从json / jsonb列中搜索为数据数组。
什么是最好的或正确的方法?
SELECT * FROM column_name
WHERE
-- How i can do,similar to this?
data #> '{groupId}' IN ('g11','g597')
-- this works but only for single. I am trying to find by array.
meta @> '{"groupId": "g597"}'