Update multiple rows with averages using mysql -
I'm very close to answering other answers to the answer, but just struggling to get off on the line I am
I have a client table structure that can not be changed, it has several tables, but the two of which I am interested in are (simplified):
Table 1: ID1 (PK), ID2 (PK)), ID3 (PK), AV Girperant (currently blank)
Example:
ID 1, ID 2, id3, avgpcant a, b, c, cord, e, table 2: id 1 (pk), id 2 (pk), id 3 (pk), id 4 (pk), percent
For example A: A, B, C, D, 88, A, B, C, E, 80 A, F, A, B, C, D, G, D, 92 What I need to do is to update Table 1 to fill AVGPresentcent so that it looks like this: ID1, ID2, ID3, AVGPRC T - A, B, C, 84 I can do this for oddly without line and I table 2 From the average (percent) I can use php and then loop updates through AVGP in the table 1 through 26,000 records, but is there a way to update all the agg-peers in the same tablet? You can use UPDATE using JOINS as below
select ID1, id2, id3, average (percent) ) From Table2 Group ID1, ID2, ID3
E, F, G, 92
Join
Comments
Post a Comment