获取(语法错误或访问违规1064)不知道是什么问题。 为什么我会出现这个错误? 我觉得我的日期语法有问题
我的代码:
$sql = "SELECT ds.id
FROM documents ds
INNER JOIN institutions_if ib on ds.to_inst_id = ib.id
INNER JOIN documents_log dl on ds.id = dl.doc_id
WHERE
ds.to_inst_id in :insts
AND DATE(FROM_UNIXTIME(dl.timestamp)) = '2014-12-31' // <======== ERROR HERE!!!!!
AND ds.status in ('sent','received','accepted','archived')
AND ds.template_id = :template1
AND NOT EXISTS (
SELECT id FROM documents dr
WHERE
dr.reply_to = ds.id
and dr.template_id = :template2
and dr.status in ('sent','received','accepted','archived')
and dr.to_inst_id in :insts
);";
$result = db_query($sql, array(
':insts' => institution_children_plan('[237, 279, 373]'),
':template1' => DocumentTemplate::get_template_by_handler('disp_suspend_operat_cont'),
':template2' => DocumentTemplate::get_template_by_handler('comun_anul_disp_susp_oper')
));
您错过了内容中第一个附近的()
WHERE ds.to_inst_id in (:insts)
因此在下一个和