-1
手冊我有這樣的SQL查詢SQL錯誤:'您的SQL語法錯誤;檢查對應於你的MySQL服務器版本正確的語法」
SELECT sites.id, sites.url, GROUP_CONCAT(categories.name,"|",
categories.color SEPARATOR ",") AS categories
FROM sites
LEFT JOIN categories_data ON sites.id = categories_data.sites_id
LEFT JOIN categories ON categories_data.categories_id = categories.id
WHERE sites.deleted=0
AND WHERE categories.deleted=0
AND WHERE categories_data.deleted=0
GROUP BY sites.id
我得到這個錯誤:
Database_Exception [ 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 'WHERE categories.deleted=0 AND WHERE
categories_data.deleted=0 GROUP BY sites.id' at line 5 [ SELECT sites.id,
sites.url, GROUP_CONCAT(categories.name,"|",categories.color SEPARATOR ",")
AS categories FROM sites LEFT JOIN categories_data ON sites.id =
categories_data.sites_id LEFT JOIN categories ON
categories_data.categories_id = categories.id WHERE sites.deleted=0
AND WHERE categories.deleted=0 AND WHERE categories_data.deleted=0 GROUP BY
sites.id ]
這個錯誤是什麼意思?
您有多個'WHERE'關鍵字。第二個應該只是'和',而不是'和WHERE' –
此錯誤意味着該SQL語句是如此畸形的解析器甚至不會嘗試給你關於如何解決它的具體意見。該錯誤是MySQL的分析器告訴你閱讀如何寫一個有效的SQL SELECT語句的手冊:http://dev.mysql.com/doc/refman/5.0/en/select.html –
是杜佩:HTTP:/ /stackoverflow.com/questions/7884522/mysql-error-an-error-in-your-sql-syntax-check-the-manual-that-corresponds-to –