1
votes

I'm trying to LEFT OUTER JOIN two tables and then INNER JOIN another table together in Access 2007.

    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

I keep getting a Syntax Error in my query expression. "INNER JOIN RestaurantTag rt ON rt.TagID = r.TagID"

I have a Corresponding TagID in both the Restaurant and RestaurantTag tables. I can't seem figure out why I'm getting this error.I can successfully JOIN the first two tables but the third table is the one giving me trouble. Any suggestions would be greatly appreciated!

3

3 Answers

2
votes

Without seeing a table definition this is a guess, but you have an error:

INNER JOIN RestaurantTag rt ON r.TagID = t.TagID should be INNER JOIN RestaurantTag rt ON r.TagID = rt.TagID

1
votes

Try to put the join expression in ()

(Restaurants r LEFT OUTER JOIN RestaurantPictures rp ON r.ID = rp.ID) 
 INNER JOIN RestaurantTag rt ON r.TagID = t.TagID
0
votes
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