Results 1 to 3 of 3
  1. #1
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265

    Show only mistmatches from LEFT table

    I am creating a query. For my data sources, I am using two tables. I am trying to figure out the best way to link these two so that I can return any instances in the first table, that do not appear in the second table (like a LEFT OUTER Join without the matches).



    The first table has two fields: subCompany and subEmp. Each employee appears only once. A company may appear more than once since a company can have more than one employee associated with it. No primary key designated (not sure if it is really needed).

    The second table has the following fields: subCompany, subEmp, invoiceNo, invoiceDate, subHours, billRate and invAmount.

    The first table lists all possible subcontractors that we can receive invoices from. The second table contains invoicing data received from the subcontractors. I plan on using a parameter query to prompt the user to specify a month, then when the query executes, it will list all subcontractors and subEmployees (from table 1) that we have NOT received an invoice from.

    What is the best way to approach this? Should I use Primary keys? If I use a LEFT OUTER Join, I will get all records from table1, plus any records that match in table2 But I don't want that. I only want instances in table 1 that do not match records in table 2 (for the month the user chooses in the parameter query).

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    If I use a LEFT OUTER Join, I will get all records from table1, plus any records that match in table2 But I don't want that. I only want instances in table 1 that do not match records in table 2 (for the month the user chooses in the parameter query).
    Access has a Query Wizard for just this sort of thing, it is called "Find Unmatched Query Wizard" .Basically, it is just a Left Join where you return records where a field from the right side is "Null", or cannot be found (no match).
    You can start there, and then add your parameter.

  3. #3
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by JoeM View Post
    Access has a Query Wizard for just this sort of thing, it is called "Find Unmatched Query Wizard" .Basically, it is just a Left Join where you return records where a field from the right side is "Null", or cannot be found (no match).
    You can start there, and then add your parameter.
    Awesome. It worked.

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

Similar Threads

  1. Left OUTER Join to more than one table?
    By oemar00 in forum Queries
    Replies: 3
    Last Post: 09-20-2013, 03:58 PM
  2. Replies: 4
    Last Post: 05-11-2013, 07:51 AM
  3. Replies: 8
    Last Post: 11-04-2011, 06:52 AM
  4. Left table NOT returning all results
    By Battlecat in forum Queries
    Replies: 3
    Last Post: 11-02-2011, 08:08 AM
  5. Replies: 3
    Last Post: 02-02-2011, 01:00 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