1
我目前正在试图做到这一点sql
查询,但我不是最大的SQL:尝试使用时有我的SQL语法错误连接
var sqlQuery = `
SELECT user.ID, user.email, user.first_name, user.last_name,
user.address1, user.address2, user.country, user.gender
FROM subscriber AS user
LEFT JOIN (
SELECT sID, name, experience, locked
FROM chars
) AS char
ON user.ID = char.sID
WHERE user.ID = ?
`;
但我得到这个错误:
[1] Errors { [Error: ER_PARSE_ERROR: 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 'char
[1] ON user.ID = char.sID
[1] WHERE user.ID = 13' at line 4]
[1] code: 'ER_PARSE_ERROR',
[1] errno: 1064,
[1] sqlState: '42000',
[1] index: 0 }
任何信息将是非常感谢。
正如martin所说,char是一个关键词...因此,char就是“c” – McValls