我正在尝试在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。
任何帮助将不胜感激。
在您第一次加入时添加一个括号,( 在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;