This bits working great:
SELECT products_id, sum(attributes_stock)
FROM products_attributes
GROUP BY products_id
Which adds together all the groups of fields in the attributes_stock
column.
What I am having trouble with is getting this result to UPDATE another column in another table.
This is what I have:
UPDATE products, products_attributes
SET products.products_quantity = sum(products_attributes.attributes_stock) GROUP BY products_attributes.products_id
WHERE products.products_id = products_attributes.products_id
Any advice greatly appreciated.