我正在使用 CodeIgniter 并尝试运行查询,但它不起作用。我相信该错误与该SET @runtot:=0;
行有关。这是代码:
<?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
"); ?>
有人可以建议一种方法来修改它,以便我可以将这个运行总和查询传递给 MySQL?谢谢。