在我将该引用中的查询实现到代码中后,我在 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 回答
- 1 回答
- 0 关注
- 446 浏览
添加回答
举报
0/150
提交
取消