Stumped by Simple Query.

  • Thread starter Thread starter TeeSee
  • Start date Start date
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;
 
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?
 
Back
Top