Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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; 
share|improve this question

1 Answer 1

up vote 3 down vote accepted

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

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 ;
share|improve this answer
    
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 '12 at 20:13
3  
Most other DBMS do not need these (and rightfully so). –  ypercube Nov 2 '12 at 20:14
    
Yes. It's my first time using MS Access. I'm just so used to SQL Server! –  deepz Nov 2 '12 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). –  ypercube Nov 4 '12 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 '12 at 9:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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