I am googling to find proper way to make subtotals in Oracle SQL. Recording to this i make query
select model,  sifra, velicina, sum(nvl(magacin,0)) as suma
from podmornica
where model ='30001'
group by  sifra, velicina, cube (model)
order by model, sifra, velicina
I have table podmornica with columns:model, sifra, velicina, magacin
But it doesn't work. Every second row in column model is null, and at the end not calculate sum. How to solve this? Thanks
P.S. In one MODEL we have variations of SIFRA, i wan't as result to have subtotals for each SIFRA for one model (in this case model is 30001). Like below
MODEL  SIFRA     VELICINA  SUMA
30001  3000101      0        1
30001  3000102      0        2
30001  3000103      0        5
______________________________
30001                        8
 
     
    