INSERT INTO `table` (`game_id`, `first`, `second`, `third`)
VALUES
(1, 'jack', 'joe', 'pat'),
(2, 'jack', 'joe', 'jess'),
(3, 'pat', 'jess', 'jack'),
(4, 'pat', 'jess', 'jack');
This is a stats table that has the top three players for each game. I’m looking to pull all of the players and order them accordingly.
First place - 3 points
Second place - 2 points
Third place - 1 point
So, it should return:
id player points
1 jack 8
2 pat 7
3 jess 5
4 joe 4
I can’t figure out a way to do this with one query.
This should do it.
Let me Know if you need any more help.