sql >> Base de Datos >  >> RDS >> Mysql

¿Cómo actualizar una tabla usando un grupo seleccionado en un segundo y en sí mismo como fuente de datos en MySQL?

Puede hacerlo reescribiendo su consulta:

UPDATE tableA t1, (
   SELECT somekey, SUM(value) value
   FROM tableB t3
   GROUP BY somekey
) t2
SET speed = t1.value + t2.value
WHERE t1.somekey = t2.somekey;