HELP! Query Criteria not returning data

K

Kristibaer

I have the following simple query with the criteria that one field does not
equal another field. The main table has 20,644 records and I should be
getting 20,626 records in the design view yet nothing comes up. Here is the
SQL statement:

SELECT Freeze.item, Freeze.count, [Add In Items].item
FROM Freeze INNER JOIN [Add In Items] ON Freeze.item = [Add In Items].item
WHERE (((Freeze.item)<>([Add In Items].[item])))
ORDER BY Freeze.item;


Please help, on a deadline
 
K

Kristibaer

I've actually found another table to analyze my data against...thanks anyway
all!
 
M

Marshall Barton

Kristibaer said:
I have the following simple query with the criteria that one field does not
equal another field. The main table has 20,644 records and I should be
getting 20,626 records in the design view yet nothing comes up. Here is the
SQL statement:

SELECT Freeze.item, Freeze.count, [Add In Items].item
FROM Freeze INNER JOIN [Add In Items] ON Freeze.item = [Add In Items].item
WHERE (((Freeze.item)<>([Add In Items].[item])))
ORDER BY Freeze.item;


Your INNER JOIN requires that the field be equal and the
WHERE clause requires them to be different. Since there is
no way anything can meet both those conditions, no records
can be returned.

I think you need:

SELECT Freeze.item, Freeze.count, [Add In Items].item
FROM Freeze LEFT JOIN [Add In Items]
ON Freeze.item = [Add In Items].item
WHERE [Add In Items].[item] Is Null
ORDER BY Freeze.item

Note that you could have trouble with those field names
because they are both reserved words.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top