Re: running total (SQL query)
From: Robert Brodersen <rbroders_at_oracle.com>
Date: 3 Feb 93 02:44:34 GMT
Message-ID: <RBRODERS.93Feb2184434_at_af1hp.oracle.com>
Date: 3 Feb 93 02:44:34 GMT
Message-ID: <RBRODERS.93Feb2184434_at_af1hp.oracle.com>
In article <C0r7uI.po_at_bc3.GUN.de> bruno_at_bc3.GUN.de (Bruno Cirone) writes:
> I have this table:
>
> Name Score
>
> Werner 200
> Hugo -100
> Heinz 300
> Bruno 100
>
> I want this table to be printed like the following:
>
> Name Score total
>
> Werner 200 200
> Hugo -100 100
> Heinz 300 400
> Bruno 100 500
>
> How can I do that with Oracle (without report-generator) ?
select a.name, a.score, sum(b.score)
from scores a, scores b
where a.name <= b.name
group by a.name, a.score
order by a.name desc