Stumped by Simple Query.

T

TeeSee

I was just doing a little cleanup on a single table using a query. The
following has be stuck. SQL#1 and SQL#2 brings up the SISItemCode that
I want but #3 doesn't. Could anyone suggest why?
The code is identical except for the WHERE clause.



#1
SELECT tblMaterialMaster.AddToFileDate, tblMaterialMaster.ctlMSDSfile,
tblMaterialMaster.Funds, tblMaterialMaster.SISItemCode,
tblMaterialMaster.CostPerInvUnit, tblMaterialMaster.Supplier,
tblMaterialMaster.UpdateDate, tblMaterialMaster.Inactive,
tblMaterialMaster.Contents, tblMaterialMaster.ManufacturerName,
tblMaterialMaster.LocalGroup, tblMaterialMaster.ManufacturerNo,
tblMaterialMaster.[Material description],
tblMaterialMaster.MaterialNote, tblMaterialMaster.[CorpMatl grp],
tblMaterialMaster.InvUnit, tblMaterialMaster.ListPrice,
tblMaterialMaster.Discount, tblMaterialMaster.CostDateNote
FROM tblMaterialMaster
WHERE (((tblMaterialMaster.SISItemCode)="csp20060"))
ORDER BY tblMaterialMaster.Funds, tblMaterialMaster.SISItemCode;

#2

FROM tblMaterialMaster
WHERE (((tblMaterialMaster.SISItemCode)="csp20060") AND
((tblMaterialMaster.[CorpMatl grp])="N"))
ORDER BY tblMaterialMaster.Funds, tblMaterialMaster.SISItemCode;

#3

FROM tblMaterialMaster
WHERE (((tblMaterialMaster.[CorpMatl grp])="N"))
ORDER BY tblMaterialMaster.Funds, tblMaterialMaster.SISItemCode;
 
G

Graham Mandeno

Hi TeeSee

Does query #3 return any records at all? Of all the queries, #2 is the most
limiting and (assuming SISItemCode is the primary key) #3 is the least
limiting.

Assuming SISItemCode="csp20060" exists and several records have [CorpMatl
grp]="N", I would expect #1 to return exactly one record, #2 to return zero
or one records (depending on [CorpMatl grp]) and #3 to return multiple
records.

What exactly IS happening?
 

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