|
RE: Running Totals with MySQL: msg#00052db.mysql.c++
I have come across and modified a nice little solution to this with a big BUT. The code works out to be select @runbal:=@runbal+modamount1+(modamount2 * -1) as runbal, t.* from (select @runbal:=0) rt,mytable t where myref='Ref1' order by date,uniqueref This gives me the running total results I want except that I use Delphi with MicroOlap's DAC to interface with MySQL and their TMySQLQuery doesn't support this construct. MicroOlap tell me that it will work in the next release. Can someone give me another way to do the same thing without the use of variables? My attempts so far have failed miserably Kerry -----Original Message----- From: Kerry Frater [mailto:kerry@xxxxxxxxxxxxxxxxxxx] Sent: 21 November 2006 07:31 To: plusplus@xxxxxxxxxxxxxxx Subject: Running Totals with MySQL I need to keep a running total (not an aggregate) based on data in two columns e.g. a b calculated_col 100 -10 90 50 10 150 -10 -20 120 the rows are selected on certain WHERE criteria and so the running total is not fixed data. The running total is for display on the screen. Doing this work in the language interfacing with MySQL is causing some odd side effects so I was hoping to do the work on the MySQL side instead. Kerry -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsub=kerry@xxxxxxxxxxxxxxxxxxx -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsub=gcdmc-plusplus@xxxxxxxxxxx |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | SSQLS v2 :): 00052, Королев Илья |
|---|---|
| Next by Date: | Can some help me with this gdb output with mysql and string core: 00052, Ankur G35 Saxena |
| Previous by Thread: | Running Totals with MySQLi: 00052, Kerry Frater |
| Next by Thread: | Re: Running Totals with MySQL: 00052, Warren Young |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |