Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple restrictions on same field

Status
Not open for further replies.

Luvsql

Technical User
Joined
Apr 3, 2003
Messages
1,179
Location
CA
If I have multiple records I do NOT want to include in my query, it works fine with using (field='A' or field='B') to not include any records with values A or B. However, if I only need to include records for everything BUT 3 different values, how does that work? I've tried with the same syntax, but it's ignoring it.

This is what I have at the end:

and (left(d.glacct,4)<>'3670' or left(d.glacct,4)<>'2145' or left(d.glacct,4)<>'2070')

There are too many possible values to use the equal sign.
 
Figured it out:

and not (left(d.glacct,4)='3670' or left(d.glacct,4)='2145' or left(d.glacct,4)='2070')
 
Less code:
Code:
left(d.glacct,4) NOT IN('3670', '2145', '2070')

All I ask is a chance to prove that money can’t make me happy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top