Query Criteria Question

  • Thread starter Thread starter Ray Todd Jr
  • Start date Start date
R

Ray Todd Jr

I have the following query:

SELECT taPROPERTY.PropertyID, taPROPERTY.CLT, taDEFENDANTNAMES.Zip,
taDEFENDANTNAMES.LastName, taDEFENDANTNAMES.FirstName,
taDEFENDANTNAMES.MiddleName, taDEFENDANTNAMES.Suffix,
taDEFENDANTNAMES.Address1, taDEFENDANTNAMES.Address2, taDEFENDANTNAMES.City,
taDEFENDANTNAMES.State
FROM taPROPERTY INNER JOIN (taDEFENDANTNAMES INNER JOIN taDEFENDANTS ON
taDEFENDANTNAMES.DefendantsNameID = taDEFENDANTS.DefendantsNameID) ON
taPROPERTY.PropertyID = taDEFENDANTS.PropertyID
WHERE (((taDEFENDANTNAMES.Zip)="37901"))
ORDER BY taDEFENDANTNAMES.Zip;

If I change the where clause to a NOT (i.e., I don't want that particular
zip code), I still get that zip code included in the output. What am I doing
wrong here. The datatype for the zip code is text. If I remove the NOT (as
the sql is above), I ONLY receive the zipcode that is in the criteria.
 
Use <> for not equal. If this still doesn't seem to work, you may have
trailing spaces or something beyond the normal 5 characters.
 
Thanks Duane. You were right in that I had some trailing spaces to the zip
code which prevented this from property working. That has been corrected and
it now works.

Again,

Thanks...
 
Back
Top