Table A with JSONB column (simplified, there is more data than just 1 k:v):
{"subject": "identifier": {"system": "system-value", "value": "1234-5678"}}
Table B JSONB column:
{["identifier": {"otherInfo": {"blah": 123}, "system": "system-value", "value": "1234-5678"},"identifier": {"otherInfo": {"blah": 345}, "system": "other-system", "value": "qazwsx-edcrfv"}]}
I'm trying to find the best way to get a record from table A where table.document -> 'subject' ->> 'system' and 'value' (pseudo code) is in table.document -> 'identifier'. Table B will likely have other filters applied before table A searches on its result set.