在我將該引用中的查詢實現到代碼中后,我在 yii2 中出錯了詢問 :public function actionDeleteduplicate($date){ Yii::$app->db->createCommand("DELETE t1 FROM HrAttLogsFormatted t1 INNER JOIN ( SELECT FingerId, MIN(CreatedDate) AS MinCreatedDate FROM HrAttLogsFormatted WHERE DateIn = '".$date."' AND Late != '' GROUP BY FingerId HAVING COUNT(FingerId) > 1 ) t2 ON t1.FingerId = t2.FingerId AND t1.CreatedDate = t2.MinCreatedDate ")->queryAll(); $this->redirect(['index']); }結果 :SQLSTATE[HY000]:一般錯誤正在執行的 SQL 是: DELETE t1 FROM HrAttLogsFormatted t1 INNER JOIN ( SELECT FingerId, MIN(CreatedDate) AS MinCreatedDate FROM HrAttLogsFormatted WHERE DateIn = '2019-05-03' AND Late BY '' GROUP FingerId HAVING COUNT(FingerId) > 1 ) t2 ON t1.FingerId = t2.FingerId AND t1.CreatedDate = t2.MinCreatedDate有誰知道代碼有什么問題?
- 1 回答
- 0 關注
- 476 瀏覽
添加回答
舉報
0/150
提交
取消
