Mysql错误说“预计在FROM附近有一个表达式”

时间:2017-04-20 16:35:54

标签: mysql

SELECT users.name,
phone_info.phone_num,
FROM users LEFT OUTER JOIN phone_info
ON users.user_id = phone_info.user_id

我的数据库usersphone_info中有2个表。我想使用左连接来执行具有数字的用户。但是我收到这样的错误

Static analysis:

1 errors were found during analysis.

An expression was expected. (near "FROM" at position 43)
SQL query: Documentation

SELECT users.name, phone_info.phone_num, FROM users LEFT JOIN phone_info ON 
users.user_id = phone_info.user_id

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that 
corresponds to your MariaDB server version for the right syntax to use near 
'FROM users LEFT JOIN phone_info
ON users.user_id = phone_info.user_id' at line 3

3 个答案:

答案 0 :(得分:4)

在FROM

之前删除额外的逗号
List<WebElement> cells = tableRow.findElements(By.xpath("./*"));

答案 1 :(得分:0)

错误自我解释。

An expression was expected. (near "FROM" at position 43); 

因为您输入了逗号(,),所以MySQL需要一个表达式。只需删除它。

这是查询;

SELECT users.name,
phone_info.phone_num
FROM users LEFT OUTER JOIN phone_info
ON users.user_id = phone_info.user_id;

答案 2 :(得分:0)

SELECT users.name, phone_info.phone_num FROM users LEFT OUTER JOIN phone_info ON users.user_id = phone_info.user_id ;我刚刚删除了额外的逗号。我现在应该工作