Query hierarchical data
This article goes over how to query hierarchical data using SQL in Upsolver.
{
"purchase_id": 1, "customer_id": 1,
"products":
[
{ "name": "Orange", "quantity": 3, "unit_price": 0.25 },
{ "name": "Banana", "quantity": 4, "price": 0.1 }
]
}
{
"purchase_id": 2, "customer_id": 1,
"products":
[
{ "name": "Apple", "quantity": 1, "unit_price": 0.5 }
]
}
{
"purchase_id": 1, "customer_id": 1,
"products":
[
{ "name": "Orange", "quantity": -2, "unit_price": 0.25 }
]
}Using nested fields in GROUP BY statement:
GROUP BY statement:Calculations on hierarchical data:
Example 1
Example 2
Example 3
Example 4
Last updated
Was this helpful?