Results 1 to 8 of 8
  1. #1
    michaelxhermes is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2015
    Posts
    6

    the sql statement could not be executed because it contains ambiguous outer joins

    the sql statement could not be executed because it contains ambiguous outer joins

    Please can some one help me sort out this query error message.

    If you run the query on the attached DB file it will give this pop up error.

    I am sure it is a very simple fix. I want to know what caused this so I can show my students how to fix it and how to prevent it again.

    Many thanks

    Michael
    Attached Files Attached Files

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I am unable to download internet files from my current location.
    If you change your query to SQL View, you can copy and paste the SQL code here for us to see.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    you cannot mix outer joins with Cartesian joins (Cartesian means no join), so remove the Out_tbl since you are not using it.

    But you will then get another error about ambiguous joins, so remove the Home_tbl, because you are not using that either.

    And for future reference outer joins need to go in the 'same direction' you have both pointing to the Hols_tbl

    If you need queries where you have this situation, you need to build them up as individual queries to 'isolate' the outer or Cartesian joins

    edit:
    @JoeM - if you want to add to this the sql is

    SELECT Cust_tbl.CustRef, Cust_tbl.Forename, Cust_tbl.Surname, Hols_tbl.Cost
    FROM Out_tbl, Cust_tbl LEFT JOIN (Home_tbl LEFT JOIN Hols_tbl ON Home_tbl.FlightRef = Hols_tbl.Home) ON Cust_tbl.CustRef = Hols_tbl.CustRef;

  4. #4
    michaelxhermes is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2015
    Posts
    6

    They both look the same - I cannot see any difference in keys, types etc.

    Thanks for your advice

    But it should be a simple solution.

    I have done the same import and query myself with no problem - See the attached file Holidays New - and the query in here works fine (Query More than 1 Hol)

    But the original has a mistake I cannot find. - The pupil has done something odd.. But what?

    They both look the same - I cannot see any difference in keys, types etc.

    Any further advice would be appreciated
    Michael
    Attached Files Attached Files

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    I repeat my post above. Your query and your student's are completely different - yours does not have outer or Cartesian joins. Just look at the two layouts - how can you say they are the same?

    Yours
    Click image for larger version. 

Name:	Capture.JPG 
Views:	12 
Size:	34.0 KB 
ID:	26482

    Your students
    Click image for larger version. 

Name:	Capture1.JPG 
Views:	12 
Size:	31.7 KB 
ID:	26483

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    incidentally, your query does not require J9Out and J9Home because you don't require them in the query either

  7. #7
    michaelxhermes is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2015
    Posts
    6
    This DB query does not work
    SELECT Cust_tbl.CustRef, Cust_tbl.Forename, Cust_tbl.Surname, Hols_tbl.Cost
    FROM Out_tbl, Cust_tbl LEFT JOIN (Home_tbl LEFT JOIN Hols_tbl ON Home_tbl.FlightRef = Hols_tbl.Home) ON Cust_tbl.CustRef = Hols_tbl.CustRef;




    This DB query works
    SELECT Count(J9Cust.CustRef) AS CountOfCustRef, J9Cust.Forename, J9Cust.Surname, Avg(J9Hols.Cost) AS Average
    FROM J9Out INNER JOIN (J9Home INNER JOIN (J9Cust INNER JOIN J9Hols ON J9Cust.CustRef = J9Hols.CustRef) ON J9Home.FlightRef = J9Hols.Home) ON J9Out.FlightRef = J9Hols.Out
    GROUP BY J9Cust.Forename, J9Cust.Surname
    HAVING (((Count(J9Cust.CustRef))>1));

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    Why do you think the first one should, given the join structure is completely different (on the FROM line) and the explanation as to why it doesn't per post #3? As far as Access is concerned, the first query does not follow the syntax that Access uses.

    So far you have asked the same question 3 times and not acknowledged any of the responses. So I think you are wasting my time.

    Good luck with finding the solution

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query error - ambiguous outer joins?
    By totslnewbie in forum Queries
    Replies: 1
    Last Post: 08-27-2015, 04:30 PM
  2. How to prevent ambiguous outer joins error message
    By craigugoretz in forum Queries
    Replies: 1
    Last Post: 02-19-2015, 08:10 AM
  3. Replies: 1
    Last Post: 07-01-2014, 11:12 AM
  4. Replies: 15
    Last Post: 10-22-2012, 06:06 PM
  5. ambiguous outer joins
    By libraccess in forum Queries
    Replies: 5
    Last Post: 03-31-2012, 05:41 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums