mySQL UPDATE 查询返回“0 行受影响";

2022-01-17 00:00:00 sql-update mysql

我有这个问题:

UPDATE phonecalls 
   SET Called = "Yes" 
 WHERE PhoneNumber = "999 29-4655"

我的表是 phonecalls,我有一个名为 PhoneNumber 的列.我只想更新一个名为 Called 为yes"的列.

My table is phonecalls, I have a column named PhoneNumber. All I want to update is a column named Called to "yes".

知道我做错了什么吗?当我返回查询时,它显示 0 行受影响.

Any idea what I am doing wrong? when I return my query it says 0 rows affected.

推荐答案

按照安非他明和雅达的建议,使用 SELECT 检查您的电话号码是否在表格中.

As amphetamine and Yada suggested, check with a SELECT, if your phone number is in the table.

但请记住:如果相关行的 调用 的值已经是是",mysql 不会更改该值,因此将返回0 行受影响".所以一定要检查 called

But keep in mind: If the value for called of the row in question is already "Yes", mysql won't change the value and will therefore return "0 rows affected". So be sure to also check the current value of called

相关文章