I have 2 tables:
Equipas:
codEquipa (which is the table's primay key)
nomeEquipa
logoEquipa
estadioEquipa
cidadeEquipa
Jogo:
codJogo (which is the table's primay key)
codEquipaCasa (which is the foreign key for codEquipa)
codEquipaFora (which is the foreign key for codEquipa)
dataJogo
And have a query:*
SELECT Equipa.nomeEquipa AS "Casa",
Equipa.nomeEquipa AS "Visitante"
FROM Equipa
JOIN Jogo AS j1 ON j1.codEquipaCasa=Equipa.codEquipa
JOIN Jogo AS j2 ON j2.codEquipaFora=Equipa.codEquipa
The thing is that i have one registry in Jogo with existant foreign keys but the query don't retrieve me anything.
Thanks in advance for any help you can give me. Let me know if you need more info.
Aucun commentaire:
Enregistrer un commentaire