Re: Running Total
[email protected] Thu, 6 Mar 2003 10:46:52 +0000
| Newsgroups | gmane.comp.db.oracle.devel |
|---|---|
| Message-ID | <LYRIS-1796914-900447-2003.03.06-10.47.00--gcdod-oracle#[email protected]> |
try something like this
1* select t1.num1,(select sum(t2.num2) from test t2 where t2.num1 <=
t1.num1) tot from test t1
SQL> /
NUM1 TOT
---------- ----------
10 100
20 300
30 600
Regards
Chris Farmer
"keyur76"
<keyur76@indiatim To: "Oracle" <[email protected]>
es.com> cc:
Subject: [oracle] Running Total
06/03/2003 05:49
Please respond to
"Oracle"
I want to have running values of num2 so that display wud be something like
this
CREATE TABLE TEST (NUM1 NUMBER(2) , NUM2 NUMBER(3));
INSERT INTO TEST (NUM1,NUM2) VALUES (10,100);
INSERT INTO TEST (NUM1,NUM2) VALUES (20,200);
INSERT INTO TEST (NUM1,NUM2) VALUES (30,300);
NUM Tot
-------------
10 100
20 300
30 600
It is to be achieved using a single SELECT statement.
Thanking u in advance.
Keyur.
Get Your Private, Free E-mail from Indiatimes at
http://email.indiatimes.com
Buy the best in Movies at http://www.videos.indiatimes.com
Bid for Air Tickets @ Re.1 on Air Sahara Flights. Just log on to
http://airsahara.indiatimes.com and Bid Now !
---
Change your mail options at http://p2p.wrox.com/manager.asp or
to unsubscribe send a blank email to %%email.unsub%%.
---
Change your mail options at http://p2p.wrox.com/manager.asp or
to unsubscribe send a blank email to [email protected].