This is my query I insert the entries, and I want to perform an update using the where
You have several ways to solve the case, one of the simplest is to rename the column 'ProductID' - in the subquery - to avoid naming the table without falling into ambiguity.
...FROM (
SELECT produc.ProductoID AS id, SUM(...
) AS rg
WHERE ProductoID = rg.id...