Access 2010:加入三个表,未知错误

时间:2013-03-17 14:28:21

标签: sql ms-access

我正在尝试在SQL查询中连接MS Access 2010中的三个表。

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;

我在网上搜索,据我所知,这应该是它。我可以加入两个表没问题。我得到的错误是:“查询表达式中的语法错误(缺少运算符)”并突出显示两个INNER JOIN。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:5)

在第一次加入时添加一个括号,(这在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;