Mysql
 sql >> Database >  >> RDS >> Mysql

un modo semplice per sommare un risultato da UNION in 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