SQL query on table that has 2 columns with a foreign id on the same table

Posted by spyk on Stack Overflow See other posts from Stack Overflow or by spyk
Published on 2010-04-13T21:09:44Z Indexed on 2010/04/13 21:13 UTC
Read the original article Hit count: 342

Filed under:

Hello all,

I have a table let's say in the form of: match(id, hometeam_id, awayteam_id) and team(id, name). How do I build my SQL query in order to get a result table in the form of (match_id, hometeam_name, awayteam_name), since they both (hometeam_id, awayteam_id) reference the same table (team)?

Thank you

© Stack Overflow or respective owner

Related posts about sql