I have a PHP application which needs to update multiple product rows. This update should add a given number to the current value of the column called estoque.
Example: add 3 units to product A, 6 units to product B, etc.
Is there way to do this using only one query, like this?
insert into venda_produto (`cod`,`estoque`) values (49477,`estoque`+3), (98798,`estoque`+6) on duplicate key update `cod`=COALESCE( VALUES(`cod`), `cod`),`estoque`=COALESCE( VALUES(`estoque`), `estoque`) `
codand you want to incrementestoque?