I'm new to MS Access SQL and I am trying to JOIN
three tables to INSERT
a bunch of IDs into another table.
The query I have at the moment is:
INSERT INTO FixturePlayers (FixtureId, PlayerId, TeamId, [Position] )
SELECT
tempFixtureSquad.FixtureId, Players.PlayerId, Teams.TeamId,
tempFixtureSquad.Position
FROM
tempFixtureSquad
INNER JOIN
Players ON tempFixtureSquad.FirstName = Players.FirstName
AND tempFixtureSquad.LastName = Players.LastName
INNER JOIN
Teams ON tempFixtureSquad.Team = Teams.Team
But when I try to save this, Access says:
Syntax error (missing operator) in query expression ".
Which means sweet nada to me! It even looks like a nonsense message. There is a single "
just plonked there at the end... There are no "
in my query. and as far as I can tell there doesn't need to be.
Table tempFixtureSquad
has columns ID
(the PK), FixtureId
, Team
(the team name), Position
, FirstName
(string) and LastName
(string)
So I need to JOIN
this table to tables Players
and Teams
to get the ID
for the player and team for each record in the tempFixtureSquad
table as the FixturePlayers
table it needs inserting into uses only ID's and has no string columns (columns from that table are listed in the INSERT INTO
clause)
What am I doing wrong? Ta