I am using CodeIgniter and trying run a query but it will not work. I believe that the error relates to the SET @runtot:=0;
line. Here is the code:
<?php
$qryRunningTotalRFRs = $this->db->query("
SET @runtot:=0;
SELECT
q1.w,
q1.c,
(@runtot := @runtot + q1.c) AS rt
FROM
(SELECT week(IssuesFiledDate) AS w,
count(*) AS c
FROM tblappeals
WHERE tblappeals.Outcome = 'Upcoming'
AND tblappeals.`Year` = 2013
AND `IssuesFiledDate` >= '2013-03-31'
GROUP BY w
ORDER BY w )
AS q1
"); ?>
Can someone suggest a way to modify this so that I can pass this running sum query to MySQL? Thanks.