473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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
4 1084
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nilesh | last post by:
The problem i am facing is described as below: I have one client application which execute some stored procedure using SqlExecDirect and just after executing the statement if connection with...
37
by: Thomas Matthews | last post by:
Hi, My son is writing a program to move a character. He is using the numbers on the keypad to indicate the direction of movement: 7 8 9 4 5 6 1 2 3 Each number has a direction except...
18
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How...
20
by: Larry Woods | last post by:
I'm drawing a blank... What is the regular expression for search a string for NO occurances of a substring? Example: I want to find all lines that do NOT have the substing "image" in them. ...
73
by: Claudio Grondi | last post by:
In the process of learning about some deeper details of Python I am curious if it is possible to write a 'prefix' code assigning to a and b something special, so, that Python gets trapped in an...
16
by: Rod | last post by:
I can't get this alert to show no matter what I do. Making me crazy. One doesn't equal two...does it? <html> <head> <title>Rider Survey</title> <link rel="stylesheet" type="text/css"...
5
by: Clownfish | last post by:
OK, I'm having a brain freeze. I have a table like this: Office Name Phone ---------------------------------- SG Larry 555-1212 SG Moe 553-4444 SG Curly ...
10
by: kyosohma | last post by:
Hi, I packaged up an application I am developing into an executable. In the application, it has user configurable options. I would like a way to restart the application so that the new options...
0
by: Pabcdef | last post by:
I'd like to do the following: Program.cs: namespace ConsoleApplication1 { class Program { static void Main(string args) {
118
by: Chuck Cheeze | last post by:
This might be in the wrong group, but... Here is an example of my data: entry_id cat_id 1 20 2 25 3 30 4 25 5 35
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.