I created a mysql database to track baseball stats. I want to be able to update 1 table based on the values from another table.
For instance, Table 1 will contain the stats for each player for every game. Table 2 will contain the same fields as table 1 but show the cumulative totals for every player in each field. Therefore if there are 10 players and 20 games and each player participates in all 20, Table 1 will have 200 rows of data and Table 2 will have 10.
Example - 2 players, 2 games
Table 1
playerid, schedid, atbats, hits, etc
1,2,4,3
2,2,5,2
1,1,3,1
2,1,3,3
Table 2
playerid, GP, atbats, hits
1,2,7,4
2,2,8,5
So basically every time I insert or update data in Table1 which isn't a problem, I also want to automatically have Table 2 updated as well.
I am have difficultly trying to figure out a query for this.
Any thoughts would be appreciated....