My first ever Stackoverflow question so go easy on me, I am not very experienced with SQLite.
I have a table of football teams
CREATE TABLE IF NOT EXISTS teams (
teamId INTEGER PRIMARY KEY NOT NULL,
name TEXT,
);
and a table of matches
CREATE TABLE IF NOT EXISTS matches (
matchId INTEGER PRIMARY KEY NOT NULL,
homeTeamId INTEGER,
awayTeamId INTEGER,
);
I am trying to work out the SELECT statement that would display the list of matches but would replace both the homeTeamId and the awayTeamId numbers with the team names.
I have tried several variants but because two fields in the matches table join back to the same teams table I am getting either syntax errors or ambiguous column errors.
Sorry for a fairly basic question, any help appreciated.
Geoff
Aucun commentaire:
Enregistrer un commentaire