Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2024 10:06 PM
Hi All,
Have a VARIANT column with the following data;
CREATE TABLE unpivot_valtype AS
SELECT parse_json(
'{
"Id": 1234567,
"Result": {
"BodyType": "NG",
"ProdType": "Auto",
"ResultSets": [
{
"R1": {
"AInt": 1,
"CRates":
{
"RateA": 11,
"RateB": 12,
"RateC": 13
}
,
"EffPrice": 14,
"EffRate": 15
},
"R2": {
"AInt": 2,
"CRates":
{
"RateA": 21,
"RateB": 22,
"RateC": 23
}
,
"EffPrice": 24,
"EffRate": 25
},
"R3": {
"AInt": 3,
"CRates":
{
"RateA": 31,
"RateB":32,
"RateC": 33
}
,
"EffPrice": 34,
"EffRate": 35
} } ]
}
}') as rowDataand I want to convert "ResultSets" to rows as seen below:
Not sure how I should flatten it this way.
Thanks,
Burhan