kvaade
asked on
SQL update
I have an MySQL database with a table "players".
One record:
playerid: 1
quality: 90
round: 1
gain: 0
Another record:
playerid: 1
quality: 92
round: 10
gain: 0
I have a couple of thousand playerid's
Each playerid has (for now) two records; one for round=1 and one for existing round (10 in the example).
I need some update sentence that goes though all my playerids where round=10 (existing round) and alter gain to last quality subtracted first quality, hence sets gain=2 in the last of the two records...
This is how I want my second record to look:
playerid: 1
quality: 92
round: 10
gain: 2 <- different
One record:
playerid: 1
quality: 90
round: 1
gain: 0
Another record:
playerid: 1
quality: 92
round: 10
gain: 0
I have a couple of thousand playerid's
Each playerid has (for now) two records; one for round=1 and one for existing round (10 in the example).
I need some update sentence that goes though all my playerids where round=10 (existing round) and alter gain to last quality subtracted first quality, hence sets gain=2 in the last of the two records...
This is how I want my second record to look:
playerid: 1
quality: 92
round: 10
gain: 2 <- different
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.