select nvl(mk.model,'ИТОГ') model, sum(pr.amount) amount, sum(pr.price) price, mk.type from product pr left join maker mk on mk.model=pr.model where amount>10 group by rollup( (mk.model, mk.type) )
In group by it is necessary to specify such columns, which would ensure the uniqueness of all rows. Double parentheses are also necessary, without them subtotals will be summed up for each model. rollup in the final records makes the fields involved in the grouping NULL, in fact, on this basis, we distinguish the final record and replace the NULL with 'TOTAL'.
And the second option, I do not know whether it will be faster or not:
with Q as( select mk.model, pr.amount, pr.price, mk.type from product pr left join maker mk on mk.model=pr.model where pr.amount>10 ) select * from Q union all select 'ИТОГ', sum(amount), sum(price),' ' from Q
PS I looked at the execution plans on a small test plate: the cost for the first option is noticeably lower than for the second. The first is done by 'group by for rollup' and one pass through the table. In the second - two separate passes on the table. But the cpu-cost is higher in the first case. So you can choose which of the options is faster only on real data in a specific situation.
UPD Option 3:
select model, nvl(amount,sum(amount) over()), nvl(price, sum(price) over()), type from ( select mk.model, pr.amount, pr.price, mk.type from product pr left join maker mk on mk.model=pr.model where pr.amount>10 union all select 'ИТОГ', NULL, NULL, ' ' from DUAL ) A
If some of the columns in the initial data can be NULL, then nvl can be replaced with these columns with decode(model,'ИТОГ',sum(price) over(),price) . In general, the cost of this option is similar to the first, but the cpu-cost is much lower and just one pass through the table.