錯誤消息:SQL錯誤:SQL語法錯誤
SQL Error: 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 'AND domain = 'ard.qc' AND snapshot_id = 2010 AND locale = 'en_US'' at line 1
SQL查詢:
SELECT
entity_id,
content_id
FROM collateral_cms_mapping
WHERE entity_id IN ({$entity_ids})
AND domain = '{$this->getSite()->getInternalId()}'
AND snapshot_id = {$this->getSnapshotDao()->getCurrentSnapshot()}
AND locale = '{$locale}'
實際SQL後的值被替換,字符串連接:
SELECT
entity_id,
content_id
FROM
collateral_cms_mapping
WHERE
entity_id
IN
()
AND
domain = 'ard.qc'
AND
snapshot_id = 2009
AND
locale = 'en_US'
有什麼建議嗎?
提供變量值的包裝語言是什麼?你可以發佈整個查詢變量解析嗎? – 2010-01-04 20:30:59
建議將提供您的字符串連接/變量替換產生的實際語句。 – sberry 2010-01-04 20:31:03
我建議打印您正在運行的實際SQL查詢,而不是生成它的代碼。查看導致問題的特定查詢時,問題會更加明顯。 – Welbog 2010-01-04 20:31:28