"Not in" Subquery with WildCards...

I have two tables - the first is a list of projects with Project Numbers in the 'PROJ' field like this:

TE47000
TE47300
BD40999
BD43999
FI50000
FI49999

etc etc

I want a query to filter this list of projects bby wildcards eg:
Not Like "FI*"

However I want to hold the list of wildcards in a seperate table (there are going to be multiple queries which need updating regularly, so I dont want to have to edit each query - I'd rather hold the list of wildcards as a separate table.

So I've tried doing this as a subquery like this:

SELECT DISTINCT PROJECTTABLE.PROJ
FROM PROJECTTABLE
WHERE (((PROJECTTABLE.PROJ) Not In (Select [FILTERTABLE].[WILDCARD] from [FILTERTABLE])))

This doesnt work as the original project numbers dont match the filters, so it returns all projects..  What I need to do is make if 'Not Like' rather than 'Not In' but this returns an error.

Any ideas?..
xTheBanditxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MargarePCommented:
Maybe <> ?
0
NGPSoft1Commented:
It's a little crude, but you could use something like

SELECT DISTINCT PROJECTTABLE.PROJ
FROM PROJECTTABLE
WHERE Left(PROJECTTABLE.PROJ,2)<>"FI"
0
xTheBanditxAuthor Commented:
This isnt the solution I need... I need the list of 'FI' and other types to sit in a seperate table and compare the two, rather than edit these in the query itself..

Any0one else?
0
NGPSoft1Commented:
What about this:

SELECT DISTINCT PROJECTTABLE.PROJ
FROM PROJECTTABLE
WHERE Left(PROJECTTABLE.PROJ,2) Not In (Select [FILTERTABLE].[WILDCARD] from [FILTERTABLE])

This is of course assuming the FilterTable.Wildcard data is all 2 characters. If it's not, then:
SELECT DISTINCT PROJECTTABLE.PROJ
FROM PROJECTTABLE
WHERE Left(PROJECTTABLE.PROJ,2) Not In (Select Left([FILTERTABLE].[WILDCARD],2) from [FILTERTABLE])


One additional note: Not In subqueries tend to run pretty slow, especially on a big list.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
xTheBanditxAuthor Commented:
thats the puppy.... much obliged... ;)

nick
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.