'Total of Various Columns as a Separate Column in Oracle
Could you help me out with an issue I have in Oracle? Let's say I have a table that tells me about how many items were sold in each month, and looks like so:
| Item | January | February | March | April |
|---|---|---|---|---|
| Computer | 3 | 5 | 2 | 9 |
| TV | 10 | 12 | 16 | 14 |
| Camera | 22 | 25 | 20 | 27 |
What I need in the output is a table that would count the total number of items sold over the period, and would look like this:
| Item | January | February | March | April | Total |
|---|---|---|---|---|---|
| Computer | 3 | 5 | 2 | 9 | 19 |
| TV | 10 | 12 | 16 | 14 | 52 |
| Camera | 22 | 25 | 20 | 27 | 94 |
I am honestly not sure how to do that. Should I use grouping()? Thank you in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
