How can I update a field in a MySQL database table by addition in MySQL database in a single query

前端 未结 2 1525
北荒
北荒 2021-01-14 14:08

I have a table that stores a value that will be added to over time. When I want to add to the value I would like to do so in a single query rather than -

  1. Get o
相关标签:
2条回答
  • 2021-01-14 14:26
    UPDATE table SET field = oldValue + X WHERE id = 1
    
    0 讨论(0)
  • 2021-01-14 14:31
    UPDATE table SET value = value + x WHERE id = thisID
    
    0 讨论(0)
提交回复
热议问题