Answer the question
In order to leave comments, you need to log in
How to display select and sum of rows in Oracle?
There is a select, let's say
output
name cost
a 500
b 100
c 300
I need to display with the sum of the lines, like this
name cost
a 500
b 100
c 300
d 900 - the sum of the lines
Help plz select name, cost from table
Answer the question
In order to leave comments, you need to log in
This can be done with union (as @zhainar wrote) or rollup :
select name, sum(cost)
from table
group by rollup(name)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question