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

mySQL UPDATE query returns quot;0 rows affectedquot;(mySQL UPDATE 查询返回“0 行受影响;)

本文介绍了mySQL UPDATE 查询返回“0 行受影响";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个问题:

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

这篇关于mySQL UPDATE 查询返回“0 行受影响";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:mySQL UPDATE 查询返回“0 行受影响";

基础教程推荐