MySQL complicated (for me) query

admin

Administrator
Staff member
i can't understand how to write a query, could u help me ?
The problem is like this: my DB has 3 tables and is about a game , in every match there are 2 players that partecipate with nicknames and every player can join a game with whatever nickname he wishes. Once a nickname is assigned to a player it can't be shared by another player. So my 3 tables are:
Table1 : Game identifier (primary key), nickname1, nickname 2
Table2 : Nickname (primary key), User_id
Table3 : User_id, Username, Userdata

i wish to create a table that shows:
Game identifier, Username1, Username2

but i cant understand how to refer twice to the same table nickname, once for the first player and once for the second player. Have i to use aliases ? If so, could u explain how ?
Thanx veeery much

Wentu
 
Back
Top