Sunday, 15 September 2013

How to do this selection on multiple rows in same table

How to do this selection on multiple rows in same table

I have the following fields in a table in mysql:
Name
Playing round
Points
So this table contains the following records:
Name Playing round Points
Test1 1 1
Test1 2 5
Test1 3 6
The points are build up cumulative, so I want to do the following selection:
Select for example playing round 1 and playing round 3 and do an minus on
the points for every unique name. So I'm expecting this result:
Name Points
Test1 5 (6-1)
How do I do this in an php query when I receive the 2 playing round
variables through an php form?

No comments:

Post a Comment