ACC97: Outer Join Returns Wrong Records with ODBC Tables vs. Local Tables

ID: Q225422


The information in this article applies to:

Moderate: Requires basic macro, coding, and interoperability skills.


SYMPTOMS

You may get different results running a query that contains a WHERE clause and an outer join to another query on a local table than you get on an linked ODBC table. This happens even though the local table and the linked table contain the same data.


CAUSE

When the tables are local, the WHERE clause is processed before the outer join. However, when the tables are linked, the queries are combined into a single SQL statement and the WHERE clause is processed after the outer join.


RESOLUTION

To prevent this problem, install Microsoft Jet 3.51 Service Pack 2.


STATUS

This problem was corrected in Microsoft Jet 3.51 Service Pack 2.


MORE INFORMATION

For additional information about Microsoft Jet 3.51 Service Pack 2, please see the following article in the Microsoft Knowledge Base:

Q172733 ACC97: Updated Version of Microsoft Jet 3.5 Available on MSL

Steps to Reproduce Behavior

  1. Create a new database with the following tables and queries:


  2. 
       Table: Table1
       -----------------
       Field Name: a
       Data Type: Number
    
       Field Name: b
       Data Type: Text
    
       Table: Table2
       -----------------
       Field Name: a
       Data Type: Number
    
       Field Name: c
       Data Type: Text
    
       Query: Query1
       -------------
       Field: a
       Table: Table2
    
       Field: c
       Table: Table2
       Criteria: "x"
    
       Query: Query2
       ------------------------------
       Join: Table1.[a] -> Query1.[a]
    
       Field: a
       Table: Table1
    
       Field: b
       Table: Table1
    
       Field: c
       Table: Query1 
  3. Add the following records to Table1:


  4. 
       a     b
       -------
       1     a
       2     b
       3     c  
  5. Add the following records to Table2:


  6. 
       a     b
       -------
       1     x
       2     y
       3     z  
  7. Select Query2, and then click Open.

    Note that there are three records.


  8. Export Table1 and Table2 to a SQL Server.


  9. In the Access database, rename Table1 and Table2 to Table1_local and Table2_local, respectively.


  10. Create a link to Table1 and Table2 on the SQL Server. You do not need to select a unique record identifier.


  11. Rename the linked tables to Table1 and Table2.


  12. Select Query2, and then click Open.

    Note that there is only one record.


Additional query words: pra link attach attached


Keywords          : kbdta 
Version           : WINDOWS:97
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: April 14, 1999