467,911 Members | 1,519 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,911 developers. It's quick & easy.

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

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!

Nov 18 '05 #1
  • viewed: 973
Share:
4 Replies
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!
***************************

"D. Shane Fowlkes" wrote:
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!

Nov 18 '05 #2
I'll check but the file is definitely there....

TIA
"Cowboy (Gregory A. Beamer) - MVP" <No************@comcast.netNoSpamM> wrote
in message news:7A**********************************@microsof t.com...
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!
***************************

"D. Shane Fowlkes" wrote:
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!

Nov 18 '05 #3
Yep...all fields are "Long Integers" (MS Access versions).
"Cowboy (Gregory A. Beamer) - MVP" <No************@comcast.netNoSpamM> wrote
in message news:7A**********************************@microsof t.com...
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!
***************************

"D. Shane Fowlkes" wrote:
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!

Nov 18 '05 #4
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
"D. Shane Fowlkes" wrote:
Yep...all fields are "Long Integers" (MS Access versions).
"Cowboy (Gregory A. Beamer) - MVP" <No************@comcast.netNoSpamM> wrote
in message news:7A**********************************@microsof t.com...
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!
***************************

"D. Shane Fowlkes" wrote:
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!


Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

37 posts views Thread by Thomas Matthews | last post: by
18 posts views Thread by Q. John Chen | last post: by
20 posts views Thread by Larry Woods | last post: by
73 posts views Thread by Claudio Grondi | last post: by
16 posts views Thread by Rod | last post: by
5 posts views Thread by Clownfish | last post: by
10 posts views Thread by kyosohma | last post: by
118 posts views Thread by Chuck Cheeze | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.