reason: having a huge table which slows down db, need to do analyse daily and add that to existing analytics (avoid analyse on huge bunch of data each day)
table a (existing analyticsa)
Code:
a 5
b 10
d 30
table b (today analytics)
Code:
a 5
b 10
c 15
as a result of 'join' of those 2 tables a should become:
table a
Code:
a 10
b 20
c 15
d 30
How to go about that most efficently ?
__________________
Found a flower or bug and don't know what it is ? agrozoo.net galery
if you don't spot search button at once, there is search form: agrozoo.net galery search
I'd be curious to hear if there is an efficient MySQL solution, but this sounds like a processing thing, and with that the solution would be to pull, sum, and insert.
I don't know if there is a method to sum where key's match.
insert into a
select from b
ON DUPLICATE KEY UPDATE
sum_field = (a.sum_ + b.sum),
__________________
Found a flower or bug and don't know what it is ? agrozoo.net galery
if you don't spot search button at once, there is search form: agrozoo.net galery search