INSERT INTO c ( SELECT tok, sum(count) FROM ( SELECT tok, count FROM a UNION ALL SELECT tok, count FROM b ) GROUP BY tok )