gpt4 book ai didi

Mysql错误说 "an expression was expected near FROM"

转载 作者:行者123 更新时间:2023-12-01 00:37:54 24 4
gpt4 key购买 nike

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

最佳答案

去除 FROM 前多余的逗号

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

关于Mysql错误说 "an expression was expected near FROM",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43525150/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com