Access 2010: joining three tables, unknown error

I am trying to join three tables in MS Access 2010 in an SQL query.

SELECT Track.trackName, TrackIsGenre.genre, ContainsTracks.albums
FROM Track 
INNER JOIN TrackIsGenre ON  Track.trackName = TrackIsGenre.track
INNER JOIN ConstainsTracks ON Track.trackName = ContainsTracks.tracks
WHERE genre = "Rock"
ORDER BY trackName ASC;

I searched the net, and as far as I can see, it should be like that. I CAN NOT JOIN two tables. The error I get is: "Syntax error (missing statement) in the query expression," and it allocates two INNER JOINs.

Any help would be greatly appreciated.

+5
source share
1 answer

Add brackets for the first connection (this is not necessary on MOST RDBMS)

SELECT  Track.trackName, TrackIsGenre.genre, ContainsTracks.albums
FROM    (Track INNER JOIN TrackIsGenre ON  Track.trackName = TrackIsGenre.track)
        INNER JOIN ConstainsTracks ON Track.trackName = ContainsTracks.tracks
WHERE   genre = "Rock"
ORDER   BY trackName ASC;
+5
source

All Articles