这个SQL有什么问题吗?
我花了很多时间试图解决这个问题。
SELECT *
FROM `users`
WHERE `IP` = `123.231.213.132`
这有什么问题吗?
#1054 - Unknown column '123.231.213.132' in 'where clause'
I've spend good hours trying to fix this one.
SELECT *
FROM `users`
WHERE `IP` = `123.231.213.132`
What is wrong with this?
#1054 - Unknown column '123.231.213.132' in 'where clause'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您不应该对列值使用反引号。你必须使用单引号或双引号,否则 mysql 会将该值视为列名。
You should not use backticks with column values. you have to use either single or double quotes otherwise mysql will consider that value as a column name.
对于
`123.231.213.132``
使用单引号而不是反引号字符Use single quotes rather than backtick characters for
`123.231.213.132``
对字符串文字使用引号“而不是反引号”
Use quotes ' not backticks ` for string literals
反引号是怎么回事?使用单引号
另外我假设 users 是一个表名,IP 是一个用户实体。
另外......你必须用分号结束你的陈述
What's with the backticks? Use single quotes
Also I'm assuming that users is a table name and IP is an entity of users.
Also...you have to end your statement with a semi-colon
它可能是单个语音标记符号。尝试手动替换它们。
It might be the single speach mark symbol. Try replacing them manually.
您在 mysql 语句中使用了错误的引号字符
来指定字符串值,您必须使用 '(单引号)或 "(双引号)
`(反引号)字符来显式指定带引号的字符串代表 mysql 应该使用的字段名称 获取数据反引号
如果列名与 mysql 的保留关键字(例如
index
、where
等)冲突,则语句中需要you are using wrong quotation characters
to specify string value in mysql statement you have to use either '(single quote) or "(double quote)
`(backtick) characters are used to explicitly specify that quoted string represents a field name from where mysql should get the data
backticks are required in your statements if column names are conflicting with mysql's reserved keywords like
index
,where
, etc