Results 1 to 3 of 3
  1. #1
    Stevens7 is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    2

    Question Outer Join Nested in Inner Join

    Hi all,



    I'm new to Access and I've hit a problem that has my head spinning. Any help would be greatly appreciated!

    I'm trying to create an outer join query that displays a list of work items from a parent table and then displays the corresponding hours worked per item. It's important that I use an outer join for a step I'm going to be taking later.

    The problem is that I need to filter the results by job. I've created a form with a combo box where the user can select the job for which they'd like to see the hours worked. Unfortunately, I'm having a heck of a time trying to structure the query.

    Here's the SQL:

    SELECT Items.Item, Items.IType, Items.IDescription, Items.[IU/M], Sum(LaborHours.LHours) AS SumOfHours
    FROM Jobs INNER JOIN (Items LEFT OUTER JOIN LaborHours
    ON Items.ID=LaborHours.ItemID)
    ON Jobs.ID=LaborHours.JobID
    GROUP BY Items.Item, Items.IType, Items.IDescription, Items.[IU/M], Jobs.Job
    HAVING (((LaborHours.JobID) = [Forms]![JobCostReport].[JC1]));

    This returns the error "Join Expression not supported". If I change the LEFT OUTER JOIN to INNER JOIN, it accepts the code.

    For reference, the query is drawing from three separate tables: Jobs, Items, and LaborHours. I need it to be an outer join because later I'm going to add a field from a separate Budgeted Labor Hours table, and the records in that table don't always match up exactly with the actual LaborHours.

    Any advice would be greatly appreciated! Let me know if I can provide any more info!

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    speaking strictly about the join syntax, if you're looking for:
    Jobs ------ Items -----> LaborHours
    try:
    FROM (Jobs INNER JOIN Items ON Items.ID=Jobs.ID) LEFT JOIN LaborHours ON Items.ID = LaborHours.ItemID

  3. #3
    Stevens7 is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    2
    Thanks for the reply! I gave the code a try, but unfortunately it didn't work.

    I think the problem is because the Jobs and Items tables don't have any information that is linked. They are both parent tables that are referenced in the LaborHours table.

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

Similar Threads

  1. Help creating outer join query
    By jobrien4 in forum Queries
    Replies: 5
    Last Post: 09-12-2011, 01:56 PM
  2. Outer Join Composite Key
    By Lady_Jane in forum Queries
    Replies: 6
    Last Post: 08-26-2011, 09:44 AM
  3. Union query (or Inner/Outer join?)
    By LilMissAttack in forum Queries
    Replies: 4
    Last Post: 10-23-2010, 12:36 AM
  4. Ambiguous Outer Join Error
    By scruiks in forum Queries
    Replies: 3
    Last Post: 07-18-2010, 05:06 PM
  5. 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

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