开发者

Trying to add 1 to current field value with MySQL, but can't figure out what's wrong with my syntax

I'm hoping someone can spot my mistak开发者_如何学Ce in this MySQL query.

UPDATE 'databasename'.'tablename' 
   SET fieldB = fieldB + 1 
 WHERE fieldA = '2';

I'm basically trying to add 1 to the current value of fieldB where fieldA is i.e 2.


Single-quotes are for strings.

UPDATE `databasename`.`tablename` 
SET fieldB = fieldB + 1 
WHERE fieldA = '2';

You can use backticks around the database and tablenames; they aren't strictly necessary though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜