I have 2 tables, users and players
In table users, I have columns userid and username.
In table players, I have columns id, player1, and player2. Column id is an auto increment primary key. Both, player1 and player2 are foreign keys of userid in table users
I’m try to perform a join where I have both player1 and player2 usernames in the same row. For example, userid 4 has a username Sam and userid 6 has a username Kevin. This would be an example of the query result for just one row:
player1 username player2 username
------------------------------------
4 Sam 6 Kevin
You can join a single table multiple times as long as you have unique aliases each time: