I'm trying to read data from a table who has multiple columns and one of them is JSON data. Inside this JSON there is an array of JSON's that I want to get one specific value.
The JSON looks like this:
{
"FirstName": "Carlos",
"LastName": "Perez",
"PhoneNumbers": [{
"PhoneNumber": "123456789"
},
{
"PhoneNumber": "987654321"
}]
}
What I want is to read this JSON column so it gives me only the phones numbers.
I want to get a result like this:
| Id | Column 1 | Column 2 | JSON Column |
|---|---|---|---|
| 1 | Value 1 | Value 2 | 123456789, 987654321 |
OPENJSON, and then string aggregation. There's plenty of examples.om how to do both of these things, what about the wealth of information out there didn't you understand? What about your attempts didn't work? What were your attempts?