1
执行查询时,这里是我的代码:一般错误SQLSTATE [HY000] Yii中2
$sql = "
SET @run_balqty :=0;
SELECT
transaction_date,
item_id,
item_description,
unit_id,
quantity,
(@run_balqty := @run_balqty + quantity) AS balance_qty,
reference_code
FROM
`report_ledger` AS ledger
WHERE
item_id = 3147
ORDER BY
transaction_date ";
$query = Yii::$app->db->createCommand($sql)->queryAll();
当我试图运行此代码。我得到这个错误。
SQLSTATE [HY000]:常规错误
现在..我的问题是:为什么我得到这个错误?我怎样才能让它运行?
需要帮助。谢谢。