我正在尝试LEFT OUTER JOIN两个表,然后在Access 2007中INNER加入另一个表。
SELECT RestaurantName,
StreetAddress,
City,
State,
Zip,
RestaurantWebsite,
MenuLink,
RestaurantTimes,
PhoneNumber,
PictureTitle,
PictureTitle3,
PictureTitle3,
PictureTitle4,
PictureTitle,
TagType
FROM Restaurants r
LEFT OUTER JOIN RestaurantPictures rp ON r.ID = rp.ID
INNER JOIN RestaurantTag rt ON r.TagID = t.TagID
我在查询表达式中不断收到语法错误。 “INNER JOIN RestaurantTag rt ON rt.TagID = r.TagID”
我在Restaurant和RestaurantTag表中都有一个对应的TagID。我似乎无法弄清楚为什么我收到这个错误。我可以成功加入前两个表,但第三个表是给我带来麻烦的。任何建议将不胜感激!
答案 0 :(得分:2)
没有看到表定义这是一个猜测,但是你有一个错误:
INNER JOIN RestaurantTag rt ON r.TagID = t.TagID
应为INNER JOIN RestaurantTag rt ON r.TagID = rt.TagID
答案 1 :(得分:1)
尝试将连接表达式放在()
中(Restaurants r LEFT OUTER JOIN RestaurantPictures rp ON r.ID = rp.ID)
INNER JOIN RestaurantTag rt ON r.TagID = t.TagID
答案 2 :(得分:0)
SELECT
RestaurantName, StreetAddress, City, State, Zip, RestaurantWebsite,
MenuLink, RestaurantTimes, PhoneNumber, PictureTitle, PictureTitle3,
PictureTitle3, PictureTitle4, PictureTitle, TagType
FROM
Restaurants r LEFT OUTER JOIN RestaurantPictures rp ON r.ID = rp.ID
INNER JOIN RestaurantTag rt ON r.TagID = rt.TagID