Actually, there is a way to do this by taking advantage of variables.  If
you read my previous post on the matter, you can use variables to get a
cumulative total.
----- Original Message -----
From: "Steve Ruby" <[EMAIL PROTECTED]>
To: "Roger Karnouk" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, April 27, 2001 12:37 PM
Subject: Re: Viewing data from the previous row


> Roger Karnouk wrote:
> >
> > Is it possible in a Select query to get values from the previously read
row
> > in order to do things like cumulative sums or other formulas which
require
> > the previous value in order to calculate the current value.
> >
> > ex.
> > day     current sales  cumu_total
> > -----   -------------------  ----------------
> > 1               120              120
> > 2           60                 180
> > 3          125                305
> > 4          40                  345
> >
> > I'd like to be able to do this in one select statement
> > is this even possible?
> >
> > Roger Karnouk
> > [EMAIL PROTECTED]
> >
>
>
> You can totalize all numbers but there isn't really any way in sql
> to do cross-row type functions as you indicated?  Why can't you do the
> running some in whatever program is generating the output?
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to