MySQL Forums
Forum List  »  German

Re: Anfängerfrage: Abfrage über zwei Tabellen
Posted by: Hartmut Holzgraefe
Date: June 17, 2008 04:47AM

ungefähr so (ungetestet):

SELECT b.match_id
, t1.teamname
, t2.teamname
FROM teams t1
JOIN begegnungen b ON t1.team_id = b.team_id_home
JOIN teams t2 ON b.team_id_away=t2.team_id

Der Trick ist das Du die teams Tabelle zweimal brauchst ...

--
Hartmut Holzgraefe, MySQL Regional Support Manager EMEA

Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht Muenchen: HRB161028
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Anfängerfrage: Abfrage über zwei Tabellen
2214
June 17, 2008 04:47AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.