By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
version() |
---|
8.0.36 |
Records: 4 Duplicates: 0 Warnings: 0
root | idParentCategory | sumSubtotal | sumQuantity | total |
---|---|---|---|---|
0 | null | 0 | 0 | 9890 |
1 | 0 | 9800 | 98 | 9800 |
4 | 0 | 20 | 1 | 90 |
5 | 4 | 30 | 1 | 70 |
6 | 5 | 40 | 1 | 40 |
sumSubtotal | sumQuantity | id | idParentCategory | treeSum | depth |
---|---|---|---|---|---|
9800 | 98 | 1 | null | 9800 | 0 |
20 | 1 | 4 | null | 20 | 0 |
30 | 1 | 5 | 4 | 30 | 0 |
40 | 1 | 6 | 5 | 40 | 0 |
30 | 1 | 5 | 4 | 50 | 1 |
40 | 1 | 6 | 5 | 70 | 1 |
40 | 1 | 6 | 5 | 90 | 2 |
Records: 5 Duplicates: 0 Warnings: 0
root | idParentCategory | sumSubtotal | sumQuantity | total |
---|---|---|---|---|
1 | 99 | 9800 | 98 | 9800 |
4 | 99 | 20 | 1 | 90 |
5 | 4 | 30 | 1 | 70 |
6 | 5 | 40 | 1 | 40 |
99 | null | 0 | 0 | 9890 |
id | idParentCategory | sumSubtotal | sumQuantity | total |
---|---|---|---|---|
1 | 99 | 9800 | 98 | 9800 |
4 | 99 | 20 | 1 | 90 |
5 | 4 | 30 | 1 | 70 |
6 | 5 | 40 | 1 | 40 |
99 | null | 0 | 0 | 9890 |
root | idParentCategory | sumSubtotal | sumQuantity | total |
---|---|---|---|---|
1 | 99 | 9800 | 98 | 9800 |
4 | 99 | 20 | 1 | 90 |
5 | 4 | 30 | 1 | 70 |
6 | 5 | 40 | 1 | 40 |
99 | null | 0 | 0 | 9890 |