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

una forma sencilla de sumar un resultado de UNION en MySql

select id, sum(amount) from (
    select id,amount from table_1 union all
    select id,amount from table_2 union all
    select id,amount from table_3
) x group by id