Tell me how to make an update so that the value in the cell is not overwritten, but added (if possible without prefetching the addition but only then writing back). Infa something I will not find on this issue. Is it all real? If so, can someone know how to do it.

  • Was added as numbers are added (addition) or as strings (concatenation)? - Nick Volynkin
  • as numbers addition - ASYOU

2 answers 2

UPDATE `users` SET `logged_in` = `logged_in` + 1 WHERE `users.id` = 1 

The option is working and just tested.

     UPDATE `table` SET `field` = CONCAT(field, 'literal'); 
    • Добавлялось как числа добавляются (сложение) или как строки (конкатенация)? ........ как числа сложение - Alexey Shimansky
    • Judging by what answer was accepted, it meant arithmetic summation. - Akina
    • That is what I hinted at with a comment;) that I took from the vehicle’s question - Alexey Shimansky