 SET N_Productos =(SELECT SUM(Quantity)AS productosven, EmployeeID FROM(SELECT Orders.OrderID,Orders.EmployeeID,[Order Details].Quantity      FROM Orders  INNER JOIN DimEmployee      ON Orders.EmployeeID=DimEmployee.EmployeeID      INNER JOIN [Order Details]      ON [Order Details].OrderID=Orders.OrderID)AS X GROUP BY EmployeeId