没有明显原因的错误 1064
Error 1064 for no apparently reason
我收到了这个查询:
SELECT companies_comments.id as id,
companies_comments.post as post,
companies_comments.comment as comment,
companies_comments.date as date,
companies.`id` AS company,
companies.`name` as name,
companies.`username` as username,
companies.`photo` as photo,
companies.`status` AS company_status
LEFT JOIN companies ON companies.id = companies_comments.company
WHERE company_status NOT IN (3,4)
AND companies_comments.post =1
错误:Error Code: 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 'LEFT JOIN companies ON companies.id = companies_comments.company WHERE compa' at line 10
意外出现错误 1064。刚试过没有 ` ,结果相同。没有丢失的列。会发生什么?
您缺少表名以及查询中的 FROM
部分
SELECT companies_comments.id as id,
companies_comments.post as post,
companies_comments.comment as comment,
companies_comments.date as date,
companies.`id` AS company,
companies.`name` as name,
companies.`username` as username,
companies.`photo` as photo,
companies.`status` AS company_status
FROM companies, companies_comments
LEFT JOIN companies ON companies.id = companies_comments.company
WHERE companies.company_status NOT IN (3,4)
AND companies_comments.post =1
您还没有添加 FROM table.You 错过了 from 部分。
示例:
SELECT *
FROM table1
LEFT JOIN table2
ON table1.column_name=table2.column_name
我收到了这个查询:
SELECT companies_comments.id as id,
companies_comments.post as post,
companies_comments.comment as comment,
companies_comments.date as date,
companies.`id` AS company,
companies.`name` as name,
companies.`username` as username,
companies.`photo` as photo,
companies.`status` AS company_status
LEFT JOIN companies ON companies.id = companies_comments.company
WHERE company_status NOT IN (3,4)
AND companies_comments.post =1
错误:Error Code: 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 'LEFT JOIN companies ON companies.id = companies_comments.company WHERE compa' at line 10
意外出现错误 1064。刚试过没有 ` ,结果相同。没有丢失的列。会发生什么?
您缺少表名以及查询中的 FROM
部分
SELECT companies_comments.id as id,
companies_comments.post as post,
companies_comments.comment as comment,
companies_comments.date as date,
companies.`id` AS company,
companies.`name` as name,
companies.`username` as username,
companies.`photo` as photo,
companies.`status` AS company_status
FROM companies, companies_comments
LEFT JOIN companies ON companies.id = companies_comments.company
WHERE companies.company_status NOT IN (3,4)
AND companies_comments.post =1
您还没有添加 FROM table.You 错过了 from 部分。
示例:
SELECT *
FROM table1
LEFT JOIN table2
ON table1.column_name=table2.column_name