Results 1 to 4 of 4
  1. #1
    scruiks is offline Novice
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    2

    Ambiguous Outer Join Error

    I have 3 tables (simplified):
    Invoice Header
    Invoice_No


    Vendor

    Invoice_Detail
    Invoice_No
    Item_No

    Item Desc
    Vendor
    Item_No
    Item_Description

    I'm trying to find any Item_No in Invoice_Detail that does not have an Item_Description in Item_Desc. When I construct the query to join Invoice_Header.Vendor to Item_Desc.Vendor, Invoice_Header.Invoice_No to Invoice_Detail.Invoice_No and Invoice_Detail.Item_No to Item_Desc.Item_No where Item_Desc.Item_Description is null I get an error about ambiguous outer joins and to create a separate query to perform the first join, then include that uery in my SQL statement. I have no idea how to do this! Can anyone help?

  2. #2
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    If you are just looking for items in the invoice detail table and item description table, then just include those two tables in the query.

    SELECT Item_Desc.Item_No, Item_Desc.Item_Description
    FROM Item_Desc INNER JOIN Invoice_Detail on Item_Desc.Item_No=Invoice_Detail.Item_No
    WHERE Item_Desc.Item_Description is null OR nz(Item_Desc.Item_Description,"")=""



    Alternatively you could use a nested query approach, but generally using the IN operator can be a little slow.

    SELECT Invoice_Detail.Invoice_No, Invoice_Detail.Item_No
    FROM Invoice_Detail
    WHERE Invoice_Detail.Item_No IN (SELECT Item_Desc.Item_No
    FROM Item_Desc
    WHERE Item_Desc.Item_Description is null OR nz(Item_Desc.Item_Description,"")="")

  3. #3
    scruiks is offline Novice
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    2

    Ambiguous Outer Join

    Thank you jzwp11. The problem I'm having is that the same item# can exist for multiple vendors (with different descriptions), so I need to include the Vendor in the criteria. Your example gave me some ideas that I'm going to try however

    It worked! I just included the vendor match in the nested query. Thanks so much!

  4. #4
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You're welcome & I'm glad to hear that you came to a solution.

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

Similar Threads

  1. Error on Multiple Table Join & IIF
    By cmartin in forum Queries
    Replies: 1
    Last Post: 05-21-2010, 08:58 PM
  2. I can't get a full outer join to work
    By Bobt1993 in forum Queries
    Replies: 3
    Last Post: 03-20-2010, 10:05 AM
  3. inner join in query
    By Hrcko in forum Access
    Replies: 1
    Last Post: 02-01-2010, 05:54 PM
  4. Error using left join accessing 2 active connections
    By peterg2000 in forum Programming
    Replies: 0
    Last Post: 10-05-2009, 05:04 PM
  5. Dynamic Query Outer Join Problem
    By mjack003 in forum Queries
    Replies: 0
    Last Post: 07-21-2006, 01:07 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