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

    Unexpected results on Inner Join

    In table 1 I have "Name 1" and "08/17/2014" on row 3. This pairing doesn't occur anywhere else in the table, just once on row 3.



    I have the same pairing in Table 2, but this pairing appears twice (rows 4 and 5).

    I have a query on both tables with a double join between both name fields and date fields. Because the default join is an inner join, I should only see matches both ways. Because of this, I expected to see "Name 1 and 08/17/2014" on one row in the query results, because the 2nd occurrence in table 2 isn't paired to anything in table one. Only the first occurrence in each table is a match.

    But instead, the query results have "Name 1 and 08/17/2014" occurring twice (rows 1 and 2). Why am I getting two rows with these values in the query result, instead of only one?

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Hi, FYI Name is a reserved word in Access and spaces are bad. Can you post a screenshot of your qry? Along with a explanation of what should happen?

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    You misunderstand INNER JOIN. An INNER JOIN will show only the records from both tables where there are matches. Both records in table 2 should pair with the record in table 1 because they match. How would the query know to match only the first record? The data matches so it joins.

    On the other hand, LEFT or RIGHT JOIN will show all records from one table along with only records from another table that have a match. So going one way, if table 1 did not have the indicated pair then neither record would be retrieved. Going the other way, both records will be displayed and the fields from table 1 will be blank on those 2 rows.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Help with SQL join results
    By ynotaz in forum Programming
    Replies: 6
    Last Post: 08-18-2014, 06:37 PM
  2. Unexpected results with DAO recordset
    By GraeagleBill in forum Programming
    Replies: 1
    Last Post: 10-07-2012, 07:37 PM
  3. Unexpected Results from Curdir?
    By bginhb in forum Programming
    Replies: 6
    Last Post: 08-17-2011, 03:58 PM
  4. InStrRev returning unexpected results
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 12-07-2010, 01:04 PM
  5. Query showing unexpected results
    By johnmerlino in forum Queries
    Replies: 30
    Last Post: 10-25-2010, 07:08 AM

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