📅  最后修改于: 2022-03-11 15:05:14.054000             🧑  作者: Mango
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