|
|
|
|
|
by rhinoceraptor
3673 days ago
|
|
You can get away with it in Postgres. The app I work on stores phone numbers in a JSONB array in the following format: [{
"tags": ["cell"],
"number": "1231231234"
}]
Here's a snippet demonstrating how you can do a lateral left join on the column to find the number tagged 'cell' in tags array: select * from mytable t
left join lateral (
select phone->'number' as cell_phone from
jsonb_array_elements(t.phone_numbers) phone
where phone->'tags' @> '["cell"]'
) p on true;
|
|