错误:未知列< value>在"where子句"中 [英] Error: Unknown column <value> in 'where clause'

查看:86
本文介绍了错误:未知列< value>在"where子句"中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

遇到了mysql问题.

im试图从现有表条目中更新值.

im trying to update an value, from an existing table entry.

该表称为Parts

列是PartQuantity

其中一个条目具有Part=keksQuantity=10

现在我正尝试:

UPDATE Parts SET Quantity=20 WHERE Part = keks

但出现此错误:

Error: Unknown column 'keks' in 'where clause'

推荐答案

MySQL解释器理解的是您要更新表Parts并将列Quantity设置为20,而列与(不存在)列keks具有相同的值.

What the MySQL interpreter understands is that you want to update the table Parts and set the column Quantity as 20 to every row where the column Part has the same value as a (non-existing) column keks.

正如其他人已经说过的,如果要告诉解释器将列与进行比较,则应使用 quotes 包裹该值,如下所示: 'keks'

As other people already said, if you want to tell the interpreter to compare the column to a value, you should wrap the value with quotes, like this: 'keks'

因此,最后您的查询将是:

So, in the end your query will be:

UPDATE Parts SET Quantity=20 WHERE Part = 'keks'

这篇关于错误:未知列< value>在"where子句"中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆