MySQL Forums
Forum List  »  Newbie

Re: Cumulative sum
Posted by: J Jorgenson
Date: December 04, 2007 04:54PM

Use variables....

SET @csum:=0;
SELECT a.id, a.in, a.out, (@csum:=@csum + (a.in - a.out)) as cSum
FROM myTable AS a
;

Options: ReplyQuote


Subject
Written By
Posted
November 29, 2006 11:14AM
November 29, 2006 11:23AM
November 29, 2006 11:48AM
Re: Cumulative sum
December 04, 2007 04:54PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.