Hallo zusammen.
Dann will ich mal näher auf mein Problem eingehen.
Erstmal die Struktur:
tipspiel__mannschaften
- id
- verein
- stadion
tipspiel__saison
- id
tipspiel__spieltag
- id
- saisonid
- lfdnr
tipspiel__spiel
- id
- spieltagid
- heimid
- gastid
- lfdnr
- teimtore
- gasttore
tipspiel__datum
- id
- tag
- datum
- spieltagnr
Jetzt habe ich folgende Abfrage gestellt:
Code:
SELECT tipspiel__spiel.lfdnr AS Spielnummer, spieltagid AS Spieltag, heim.verein AS Heimteam, gast.verein AS Gästeteam, CONCAT( heimtore, ' : ', gasttore ) AS Ergebnis, datum AS Datum
FROM tipspiel__spiel
LEFT JOIN tipspiel__mannschaften AS heim ON heim.id = heimid
LEFT JOIN tipspiel__mannschaften AS gast ON gast.id = gastid
JOIN tipspiel__datum ON tipspiel__spieltag.id = spieltagnr
JOIN tipspiel__spieltag ON tipspiel__spiel.spieltagid = tipspiel__spieltag.id
WHERE spieltagid =1
AND tipspiel__spieltag.saisonid =1
ORDER BY datum ASC
LIMIT 0 , 30
und erhalte als Ergebnis:
Spielnr-Spieltag-Heimteam----------------Gästeteam----------------------------- Ergebnis-Datum
1---------------1-----FC Bayern München--VFL Borussia Mönchengladbach-3 : 0----2005-08-05
2---------------1-----FC Schalke 04----------MSV Duisburg---------------------------1 : 1----2005-08-05
3---------------1-----SV Werder Bremen---1. FC Köln---------------------------------0 : 0----2005-08-05
3---------------1-----SV Werder Bremen---1. FC Köln---------------------------------0 : 0----2005-08-06
1---------------1-----FC Bayern München--VFL Borussia Mönchengladbach-3 : 0----2005-08-06
2---------------1-----FC Schalke 04----------MSV Duisburg---------------------------1 : 1----2005-08-06
2---------------1-----FC Schalke 04----------MSV Duisburg---------------------------1 : 1----2005-08-07
3---------------1-----SV Werder Bremen---1. FC Köln---------------------------------0 : 0----2005-08-07
1---------------1-----FC Bayern München--VFL Borussia Mönchengladbach-3 : 0----2005-08-07
Das Problem ist, dass nur Spiel 1 am 05.08., Spiel 2 am 06.08. und Spiel 3 am 07.08. stattgefunden haben.
Kriege aber als Ergebnis alle Paarungen für jedes Datum geliefert.
Hoffe es war verständlich genug und vielen Dank für die Mühe.