Query Advice

H

Helga

This is in response to Ken Snell on 11/24/04: Looking for sample Tables and
Query Results:

Sample Table 1 (Vehicle):

Vehicle ID #
123456
8888888888
963852741
9999999999

Sample Table 2 (Mileage):

Mileage ID VIN # M Year M Month Mileage
1 123456 2004 October 12000
2 8888888888 2004 October 95000
3 9999999999 2004 October 12000

For example, when I query for all vehicle ID's that do not have a record in
Table 2 for November 2004, the results are:

Vehicle ID#: 963852741

What I am expecting to get is all of the records from Table 1 because none
of them have corresponding records in Table 2. The query I am referring to
is:

SELECT Table1.FieldA
FROM Table1 LEFT JOIN Table2 ON Table1.FieldA = table2.FieldA
WHERE (((Table2.FieldA) Is Null)) OR (((Table2.FieldB)<>1) AND
((Table2.FieldC)<>2));
 
Top