INSERT INTO `table2`
SELECT `type` , SUM(`salary` )
FROM `table1`
GROUP BY `type`
UPDATE table2 AS t2 JOIN (
SELECT SUM( salary ) AS summary,
TYPE FROM table1
GROUP BY TYPE
) AS t1 ON t1.type = t2.type
SET t2.summary = t1.summary WHERE t2.type = t1.type