[Dbix-class] Set a MySQL Variable Before Doing SELECT
Dave Mabe
davemabe at gmail.com
Tue Mar 15 19:23:57 GMT 2011
I'm trying to calculate a running total in the query I'm doing with
DBIx::Class, similar to what is described here:
http://stackoverflow.com/questions/664700/calculate-a-running-total-in-mysql
So basically I'll need to run this command just before running a query
to get a resultset:
SET @runtot := 0;
SELECT profit, (@runtot := @runtot + profit) AS rt FROM table;
How can I have that "SET @runtot := 0;" execute just before the SELECT
statement when I call the resultset method?
Dave
More information about the DBIx-Class
mailing list