標題不是很具體,但我不知道如何使它更好。我的 sql 中出現此錯誤,告訴我有問題,但我不明白為什么會出錯,目前使用的是 mysql 8.0.24。如果你想知道為什么它看起來很奇怪那是因為我在 lua 中使用它
查詢:
local q = [[SELECT id, hex_id, steam_id, community_id, name, ip, rank FROM users WHERE hex_id = @id;]]
local v = {["id"] = hexId}
錯誤:
An error happens for query "SELECT id, hex_id, steam_id, community_id, name, ip, rank FROM users WHERE hex_id = ?; : ["steam:*****"]": ER_PARSE_ERROR: 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 'FROM users WHERE hex_id = 'steam:*****'' at line 1
uj5u.com熱心網友回復:
RANK 是 MySQL 8 中的關鍵字。您需要將其括在反引號中:
SELECT id, hex_id, steam_id, community_id, name, ip, `rank` FROM users ...
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/377390.html
上一篇:連接表中所有分組記錄的SQL查詢
下一篇:獲取每個用戶角色的數量
