UPDATE outputtable,
(SELECT Sum(total) SUM,
Year(date) year,
Month(date) month,
Day(date) day,
Hour(date) hour
FROM inputtable
GROUP BY Year(date),
Month(date),
Day(date),
Hour(date)) InputT SET total = InputT.sum WHERE Year(outputtable.date) = InputT.year
AND Month(outputtable.date) = InputT.month
AND Day(outputtable.date) = InputT.day
AND Hour(outputtable.date) = InputT.hour;