现在是上午6点,我仍然努力执行CodeIgniter PHP框架查询。希望你们能帮助我CodeIgniter - MySQL错误1064(更新table1内连接表2(...))
代码:
$query='
UPDATE `STUDY_LIST_AUX`
INNER JOIN `study_report`
ON `STUDY_LIST_AUX.study_iuid`=`study_report.study_iuid`
SET `STUDY_LIST_AUX.report_date`=DATE_FORMAT(`study_report.report_date`,\'%Y-%m-%d %h:%i:%s\'), `STUDY_LIST_AUX.report_status` = `study_report.report_status`
';
if ($this->db->query($query))
{
echo "True!<br><br>";
}
else
{
echo "False<br><br>";
};
错误:
A Database Error Occurred
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE
STUDY_LIST_AUX
INNER JOINstudy_report
ON `STUDY_LIST_AUX.study_iu' at line 22
我用尽了一切,反引号,正常的蜱,引号,但错误依然存在。在phpmyadmin上,查询成功运行。
任何建议或想法将非常感激
在此先感谢球员:)
你试过没有'ON'条件下反引号? –
如果U表示这个 - >'ON' - 它没有工作。无论如何,谢谢;) – DFX
我的意思是'ON STUDY_LIST_AUX.study_iuid = study_report.study_iuid'。由于你的字段名称和表名似乎没问题,所以我猜没有使用反引号,它只是降低了可读性。 –