mySQL UPDATE query returns “0 rows affected”

后端 未结 11 1096
感情败类
感情败类 2020-12-05 18:39

I have this query:

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

My table is phonecalls, I

11条回答
  •  北海茫月
    2020-12-05 18:57

    For the benefit of anyone here from Google, this problem was caused by me because I was trying to append to an empty field using CONCAT().

    UPDATE example SET data=CONCAT(data, 'more');
    

    If data is NULL, then CONCAT() returns NULL (ignoring the second parameter), so the value does not change (updating a NULL value to be a NULL value), hence the 0 rows updated.

    In this case changing to the CONCAT_WS() function instead fixed the problem.

提交回复
热议问题