mysql update sum 1 code example
Example 1: mysql update set sum
UPDATE products p,( SELECT products_id, sum(attributes_stock) as mysum
FROM products_attributes GROUP BY products_id) as s
SET p.products_quantity = s.mysum
WHERE p.products_id = s.products_id
Example 2: mysql update sum same table
UPDATE products SET quantity = quantity + 10 WHERE id = 8