If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Sumarize a column in a able

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-19-03, 08:17
alekizoglou alekizoglou is offline
Registered User
 
Join Date: Nov 2003
Posts: 7
Question Sumarize a column in a able

hi,

Is there any SQL query to cumilative add a field of a table for every row. For example i have this

iID iAmount
1 1000
2 1500
3 2000


and the query should result in this

iID iAmount iSum
1 1000 1000
2 1500 2500
3 2000 4500
Reply With Quote
  #2 (permalink)  
Old 11-19-03, 13:05
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: Sumarize a column in a able

In Oracle that would be:

select iid, iamount, sum(iamount) over (order by iid) isum
from ...;
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 11-20-03, 04:51
alekizoglou alekizoglou is offline
Registered User
 
Join Date: Nov 2003
Posts: 7
Re: Sumarize a column in a able

Quote:
Originally posted by andrewst
In Oracle that would be:

select iid, iamount, sum(iamount) over (order by iid) isum
from ...;
Thanks,


Nasos
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On