If I have a table of users, for example, and I want to include the users in a query like so:
SELECT gameId, player1id, player2id, users.username as player1, users.username as player2 FROM players, users WHERE gameId = 2 AND player1.id = player1id AND player2.id = player2id
How would I handle the part of the select statement where I am getting the player names? I know what I have is incorrect but I am stuck trying to figure out the proper syntax for this.
When all is said and done I am trying to get 1 row to return that has 2 columns on the end named "player1" and "player2" with their respective usernames.