Results 1 to 3 of 3
Thread: mysql query help!
Mar 5, 2002, 19:01 #1
- Join Date
- Jul 2001
- 0 Post(s)
- 0 Thread(s)
mysql query help!
hi all, hope someone can help me..
I have a database including these tables :
to simplify things right down, lets say a row in "games" looks like this :
id | p1id | p2id | level
and "players" :
id | name | surname
how can I, in 1 query, join these 3 queries :
SELECT * FROM games WHERE p1id OR p2id=1 (select all games that player with id=1 has played in)
SELECT * FROM players where id=games.p1id (select player1's details)
SELECT * FROM players where id=games.p2id (select player2's details)
using an inner join, I managed to get the game data and player 1s details in there, but when it comes to player2, there are duplicate field names..how to get around this problem?
in a nutshell, I need to join 1 row in a table to 2 rows in another..