MySQL Forums
Forum List  »  German

Anfängerfrage: Abfrage über zwei Tabellen
Posted by: Lars Gärtner
Date: June 17, 2008 04:20AM

Hallo,

ich bin absoluter SQL-Anfänger, daher bitte ich um Nachsicht.

Also, ich habe zwei Tabellen, die ungefähr folgendermaßen aufgebaut sind:

Tabelle teams
mit team_id und teamname

Tabelle begegnungen
mit match_id, team_id_home und team_id_away

In der Tabelle begegnungen sind folgende Einträge

match_id team_id_home team_id_away
1 1 6
2 2 5
3 3 4
4 1 6
5 2 5
6 3 4


Die Tabelle teams sieht so aus

team_id teamname
1 Manschaft1
2 Manschaft2
3 Manschaft3
usw.

Nun würde ich gern eine Abfrage machen, die mir statt der IDs ungefähr folgendes ausgibt:

Match 1: Mannschaft1 - Mannschaft6
Match 2: Mannschaft2 - Mannschaft5
Match 3: Mannschaft3 - Mannschaft4

usw.


Sollte doch eigentlich ganz einfach sein, aber irgendwie habe ich ein Brett vorm Kopf.


Danke im Voraus.


Gruß
Lars

Options: ReplyQuote


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


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.