Results 1 to 5 of 5
  1. #1
    Adam121212 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2017
    Posts
    2

    Query to include only entries between two tables that do not have a match

    Hello,

    I have two tables that I am trying to run a query on. Table 1 has about 60000 entries and table 2 has about 20000 entries. Table 1 includes all of table 2's entries so table 1 actually has about only 40000 unique entries. Every entry in both tables has an ID number that identifies each entry. Basically I am trying to run a query that will isolate table 1's unique entries from table 2's to give to give me a table which only includes table 1's unique entries and does not include any of the entries that are also in table 2. So far I have started to design a query and established the relationship between the ID numbers. How can I design the query so that it returns the entries that are unique only to table 1? The resultant table would have about 40000 entries.

    Thanks

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    use a outer join. Something like


    Code:
    SELECT Table1.*
    FROM Table1 LEFT JOIN Table2 ON Table1.ID=Table2.ID
    WHERE Table2.ID is Null

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    No sure I follow, completely, and never had cause to use it, but if you crank up the Query Wizard, one of the choices you get is to use the Find Unmatched Query Wizard...which sounds like might might be what you need.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Adam121212 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2017
    Posts
    2
    Did exactly what I needed. Thanks

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Glad we could help!

    Good luck with your project!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 1
    Last Post: 12-12-2016, 03:07 PM
  2. Replies: 1
    Last Post: 10-13-2015, 05:28 PM
  3. Query to match data from two tables
    By mpreston14 in forum Queries
    Replies: 4
    Last Post: 10-30-2014, 03:09 PM
  4. Replies: 4
    Last Post: 12-30-2013, 01:49 PM
  5. Replies: 3
    Last Post: 01-05-2012, 12:04 PM

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