I have some data stored in a sql column that looks like
{
"items": [
{ "ids": [4], "fromCompanyId": 4 },
{ "ids": [6, 1], "fromCompanyId": 1 }
]
}
now I want to make a where clause that would find all "items" that have a "fromCompanyId" of "4".
All I found so far is
WHERE JSON_VALUE(jsonInfo,'$.info.address[0].state') LIKE 'US%'
but they are hardcoding the array index. I need to find all matches.
I also am trying openJson but still not working
where 4 in (select fromCompanyId from openjson(Details, '$.items.fromCompanyId') WITH( [fromCompanyId] int '$.fromCompanyId')))