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.
精彩评论