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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query excluding certain names

Status
Not open for further replies.

blubomber

MIS
Dec 27, 2001
241
US
I am trying to put together a query that will pull data from a table of customer names. But there are some generic first and last names that i want to exclude. I am trying to use the Not Like expression but there are multiple first names i want to weed out and i am not sure i am separating them correctly. Any help would be greatly appreciated.
 
Well, i am pulling data from 3 tables in an SQL database. i have created the links to the tables. There are two fields where i am using Not Like in the Criteria line, but there are only two possible options in those fields. For example, there is a status field with either an 'I' for inactive or 'A' for active. So i want all the active cutomers so i use Not Like 'I'. That works. But when i try to apply it to the First Name field, where i want to exclude, for example, all Bob and John first names i am not sure if in need to put the names in "()" separated by commas. Or maybe the Not Like Criteria is incorect.
 
Not Like '*Bob*' And Not Like '*John*' And Not Like...
 
there are multiple first names i want to weed out

if there a several

make a temp table of names to exclude then do a left join and look for the nulls OR do regular join then a not in based on a select from this query
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top