Re: Query for rolling totals

2009-09-03 Thread John Daisley
Thank you Brent, much appreciated! On Thu, 2009-09-03 at 14:12 -0400, Brent Baisley wrote: > You can do this using a variable. Set the variable starting value with > a "query": > set @runningTotal := 0 > > Then add the calculation to your total: > SELECT a. trans_id ,a.tran_date,b.cat_type,a

Re: Query for rolling totals

2009-09-03 Thread Brent Baisley
You can do this using a variable. Set the variable starting value with a "query": set @runningTotal := 0 Then add the calculation to your total: SELECT a. trans_id ,a.tran_date,b.cat_type,a.payee,a.amnt, @runningTotal := @runningTotal+a.amnt AS rollingTotal from transactions a join categories b on

Query for rolling totals

2009-09-03 Thread John Daisley
Hi, Hoping someone can help me with this little issue! It seems really simple but my brain is refusing to work. We have a transactions tables like so... mysql> desc transactions; +---+--+--+-+-++ | Field | Type | Nul