I have been searching for this answer for long on stackoverflow, but did not find anything useful. I have data in my_tbl as:
folder_id | links
--------------+----------------------------------------------------------------
761 | [{"ids": "[82293,82292]", "index": "index_1"}, {"ids": "[82293,82292]", "index": "index_2"}]
769 | [{"ids": "[82323,82324]", "index": "index_3"}]
572 | [{"ids": "[80031,79674,78971]", "index": "index_4"}]
785 | [{"ids": "[82367,82369]", "index": "index_5"}, {"ids": "[82368,82371]", "index": "index_6"}]
768 | [{"ids": "[82292,82306]", "index": "index_7"}]
I want to get all the rows where links->>'ids' contain 82292. So in this case, it should return me folder_id 761 and 768.
I achieved so far is separating ids arrays from links by - jsonb_array_elements(links) ->> 'ids'
not sure how to proceed further.