Hello everyone, I need your help.
I can’t calculate subtotal and total using GROUP BY ROLLUP
syntax in DB SQL Server 2019.
I need this return
|C | C_CO | orderid | SalesTotal |
|----|---------|----------|------------|
|7 | 710 |1 | 4 |
|7 | 7 |subtotal | 4 |
|8 | 810 |2 | 8 |
|8 | 830 |2 | 10 |
|8 | 8 |subtotal | 18 |
|E | E10 |3 | 2 |
|E | E40 |3 | 2 |
|E | E |subtotal | 4 |
| | |total | 26 |
Instead I have this DB FIDDLE
Can you help me?
Thanks in advance for any help