I'm trying to figure out how to find out which player in a game db able I have wont the most games against. I have a db table in which I have 2 rows for each game. One for me and one for the opponent. When a game is finished the player who has won is awarded some +points and the loser is given -points. So as far as i can see I have to go through the table and find all the games I have got +points. But that doesn't give me the opponents ID and count of how many I have won!
My table looks like this:
id fk_game_id fk_player_id points
So lest say I have player id 1 a won game would look like this:
1 1 1 23
2 1 2 -23
So how do I get to echo out the player I have won most game against? I have tried several of solutions with GROUP and JOINS but I got it all messed up now so I won't even post this.
Can anyone point me in the right direction!
Thanks in advance.