Simple SQL Statement....broken brain...

D

D. Shane Fowlkes

I'm stumped! I know this isn't exactly a .NET question but I know someone
here is bound to be able to help. I'm trying to write a query to extract a
list of records from a many-to-many "key" table where the records are not
within a list of possible matches. For example:

SELECT ContactID, CategoryID
FROM CategoryMatches
WHERE CategoryID Not In (16,19,20,35,39)
ORDER BY ContactID


This query STILL returns records from this table where a CategoryID listed
above is found. A sample table and query can be downloaded here:
http://www.easterassociates.com/sample.mdb (164kb) It's probably easier
just to see the query and table itself.

THANKS for helping!
 
G

Guest

Check to make sure the data type of the ID is not some form of character
data. Other than that, the query looks correct.

Unable to download the database (file not found), so I am not sure what the
issue is there.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
G

Guest

you have a many-to-many relation ship in one table
i recommend that you split this tables in tree tables
one for contactInfo ,one for category info and one that have id's that link
between to two tables
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top