L
L
Light7772016-03-14 07:01:44
Oracle
Light777, 2016-03-14 07:01:44

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

1 answer(s)
A
Alexander, 2016-03-14
@Light777

This can be done with union (as @zhainar wrote) or rollup :

select name, sum(cost)
from table
group by rollup(name)

PS
You would first decide what you specifically need. And then you ask a few similar questions. They answer you, and you disappear and ask a new similar question (could mark the answer as correct in this question , even if you realized that you asked the wrong question).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question