mysql 4.1.11
I have hit a query that I cannot make and would be really appreciative of some help. I was thinking that a derived field would be the right approach, but I can't seem to get it working.
TABLE/COLUMNS
Table: Rating
Columns: statperiod, player, totalwins
DATA
1, Bill, 5
1, Todd, 1
2, Bill 11
2, Todd, 4
I need a query that will give me the player with the most wins for the current period. The total wins culumn are the cummulative wins for the player. For example, if the current period is 2:
OUTPUT
Bill, 6 (periodwins=period 2 wins minus period 1 wins, Todd only had 3 wins in the period so Bill had the most)
I have hit a query that I cannot make and would be really appreciative of some help. I was thinking that a derived field would be the right approach, but I can't seem to get it working.
TABLE/COLUMNS
Table: Rating
Columns: statperiod, player, totalwins
DATA
1, Bill, 5
1, Todd, 1
2, Bill 11
2, Todd, 4
I need a query that will give me the player with the most wins for the current period. The total wins culumn are the cummulative wins for the player. For example, if the current period is 2:
OUTPUT
Bill, 6 (periodwins=period 2 wins minus period 1 wins, Todd only had 3 wins in the period so Bill had the most)