SELECT company.id, company.name, employee.c_id employee.name FROM company LEFT JOIN employeeON company.id = employee.c_id WHERE company.id = #{id} > 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 '.name FROM company LEFT JOIN employeeON company.id = ' at line 1
时间: 2024-02-14 13:03:01 浏览: 70
SQL之SELECT FROM
根据您提供的 SQL 语句,似乎存在语法错误。您可以尝试修改该语句,将其改为以下形式:
```
SELECT company.id, company.name, employee.c_id, employee.name
FROM company LEFT JOIN employee
ON company.id = employee.c_id
WHERE company.id = #{id}
```
在该语句中,我将 `employee.name` 移到了 `SELECT` 语句中,并在 `LEFT JOIN` 和 `ON` 之间添加了一个空格。您可以尝试使用这个语句并根据需要进行进一步修改。
阅读全文