Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Inner Join Query Problem

Status
Not open for further replies.

ImpMan

Technical User
Jan 25, 2001
42
0
0
GB
These two SQL queries return a different number of records. Why?
The 'From Tablen' expression varies depending where I start my join from in the Access expression builder. Why should this make a difference?

SELECT Table1.f4, Table2.f4
FROM Table1 INNER JOIN Table2 ON (Table1.f3 = Table2.f3) AND (Table1.f2 = Table2.f2)
ORDER BY Table1.f4;

SELECT Table1.f4, Table2.f4
FROM Table2 INNER JOIN Table1 ON (Table1.f2 = Table2.f2) AND (Table1.f3 = Table2.f3)
ORDER BY Table1.f4;

Any ideas??
 

There is no reason for the queries, as posted, to return different record sets. Which version of Access are you using? Are the tables linked or native Access tables? Are there any additional criteria in your queries? Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
The complete sql query expression is as shown above and they return a different number of records.

I suppose the expression builder is a 'red herring' though. The sql expression can be written (or built) as shown above to include the following line

from table1 inner join.....

or

from table2 inner join....

should there be any difference between the expressions?

Thanks for your help
 
Sorry I forgot the following, I am using Access 97, all the tables are linked, the expressions are exactly as stated even down to the tables names.

Why should the expressions give different results?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top