Joining the same table twice

Have a table in which I need to get two user’s usernames from it. I.e.

challenge(id, challengerid, receiverid)

challengerid and receiverid are ids from the member table.

member(id, username)

how do I get both the challengerid’s username aswell as the receiverid’s username with the same query?

Any help would be awesome!

Awesome thanks guys!

Just like you say in the title… join the same table twice, using aliasses to give them a unique name in the query:

FROM challenge
INNER JOIN members AS m1 
INNER JOIN members AS m2

i don’t like the generic aliases when there are much nicer ones available

     , challenger.username AS challenger
     , receiver.username AS receiver
  FROM challenge
  JOIN member AS challenger
    ON = challenge.challengerid
  JOIN member AS receiver
    ON = challenge.receiverid

i like this better than m1 and m2