views:

50

answers:

3

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!

+1  A: 

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

James Black
+1: You were first
OMG Ponies
Good eye. I corrected that and also added () the first statement and it worked. Thanks for the assistance.
nikl91
@OMG Ponies: only because the answer box crapped out in IE8! ;)
Mitch Wheat
@Mitch Wheat: That's why they call it "Internet Exploder" =)
OMG Ponies
@Mitch Wheat - Firefox should be your friend. :)
James Black
A: 
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 
Mitch Wheat
+1  A: 

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
THEn
This was the winner. Thanks for the help!
nikl91