I have a table data_table like this
| id | reciever
| (bigint) |(jsonb)
----------------------------------------------------------------------
| 1 | [{"name":"ABC","email":"[email protected]"},{"name":"ABDFC","email":"[email protected]"},...]
| 2 | [{"name":"DEF","email":"[email protected]"},{"name":"AFDBC","email":"[email protected]"},...]
| 3 | [{"name":"GHI","email":"[email protected]"},{"name":"AEEBC","email":"[email protected]"},...]
| 4 | [{"name":"LMN","email":"[email protected]"},{"name":"EEABC","email":"[email protected]"},...]
| 5 | [{"name":"PKL","email":"[email protected]"},{"name":"ABREC","email":"[email protected]"},...]
| 6 | [{"name":"ANI","email":"[email protected]"},{"name":"ABWC","email":"[email protected]"},...]
when i run on pg admin it works fine
I want to fetch row by putting email in where condition like select * from data_table where receiver = '[email protected]'. there can be more data in array so i have shown "...".
I have tried like where receiver-->>'email'='[email protected]' but it is working in the case {"name":"ABC","email":"[email protected]"} only not in array where i have to chaeck every email in array
Help will be appreciated.