无法找出 SQL SELECT 语句中的语法错误
Can't figure out this syntax error in SQL SELECT statement
我一直在尝试让一个简单的 SELECT 语句起作用,但我一直在 LEFT JOIN 上遇到语法错误。代码:
SELECT
p.player_name,
s.country_name
FROM player_mast p
WHERE p.team_id=1217
LEFT JOIN soccer_country s ON p.team_id = s.country_id;
我想看起来很简单,但它一直给我这个错误:
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 soccer_country AS s ON p.team_id =
s.country_id' at line 6
我使用的是 MySQL 8.0,我已经查看了文档。我是 SQL 的初学者,所以我确定我遗漏了一些明显的东西,但我就是想不通是什么..
非常感谢您的帮助。
JOIN 子句应位于 WHERE 子句之前。
SELECT
p.player_name,
s.country_name
FROM player_mast p
LEFT JOIN soccer_country s ON p.team_id = s.country_id
WHERE p.team_id=1217;
我一直在尝试让一个简单的 SELECT 语句起作用,但我一直在 LEFT JOIN 上遇到语法错误。代码:
SELECT
p.player_name,
s.country_name
FROM player_mast p
WHERE p.team_id=1217
LEFT JOIN soccer_country s ON p.team_id = s.country_id;
我想看起来很简单,但它一直给我这个错误:
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 soccer_country AS s ON p.team_id = s.country_id' at line 6
我使用的是 MySQL 8.0,我已经查看了文档。我是 SQL 的初学者,所以我确定我遗漏了一些明显的东西,但我就是想不通是什么..
非常感谢您的帮助。
JOIN 子句应位于 WHERE 子句之前。
SELECT
p.player_name,
s.country_name
FROM player_mast p
LEFT JOIN soccer_country s ON p.team_id = s.country_id
WHERE p.team_id=1217;