4

I'm having problems joining three tables. It works well when I use the same query for joining two tables (after removing LEFT OUTER JOIN C ON B.No = C.No). However, it doesn't work when I use three tables.

This is my query

SELECT A.Name, B.Quantity, C.Quantity 
FROM A 
LEFT OUTER JOIN B 
    ON A.ID = B.ID 
LEFT OUTER JOIN C 
    ON B.No = C.No; 
1
  • If you set up your joins using Design View of the Access query designer, it will add the parentheses Access requires when the FROM clause includes more than one join.
    – HansUp
    Apr 29, 2016 at 18:29

1 Answer 1

7

MS-Access is rather picky at how it wants the joins to be formed. Add parentheses:

SELECT A.Name, B.Quantity, C.Quantity 
FROM 
  ( A LEFT OUTER JOIN B ON A.ID = B.ID )
  LEFT OUTER JOIN C ON B.No = C.No ;

Standard SQL syntax - and most other DBMS - do not need require parentheses in the FROM clause, although you are allowed to use them for clarity.

5
  • Thank you for your response. It worked! Thank you so much. I knew my query was right, just missed out the parenthesis. Thanks once again. God bless! :)
    – deepz
    Nov 2, 2012 at 20:13
  • 4
    Most other DBMS do not need these (and rightfully so). Nov 2, 2012 at 20:14
  • Yes. It's my first time using MS Access. I'm just so used to SQL Server!
    – deepz
    Nov 2, 2012 at 20:15
  • @deppz: You know there is an SQL-Server Express edition? (not with the full capabilities of the higher editions but it may serve your needs). Nov 4, 2012 at 11:46
  • Yes I've used that before. For this particular task I only had to use MS Access. Thanks for your suggestion though.
    – deepz
    Nov 5, 2012 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.