I have the following query, which works:
select filename, hour, sum(joe) as joe_total, sum(bob) as bob_total
from t1
group by filename, hour
This gives thousands of rows of data under the following columns:
filename, hour, joe_total, bob_total
Each filename contains 24 hours, so the first row of results would be
filename1, 1, [joe_total_value_hour1], [bob_total_value_hour1]
... and the second row would be
filename1, 2, [joe_total_value_hour2], [bob_total_value_hour2]
... etc.
I have another table called t2 with the following fields:
filename, hour, joe_total, bob_total, mary_total, gertrude_total
The table t2 also has thousands of rows (more than the result of the select above), but currently the columns joe_total and bob_total contain only zeros and need to be updated.
So I want to update t2 so that
t2.joe_total = [resuls from the select].joe_total
and similarly for t2.bob_total for each filename/hour.
Any ideas how I could accomplish this?