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

Select Query for Records NOT Equal To 1

Status
Not open for further replies.

maduko

IS-IT--Management
Mar 24, 2003
43
0
0
US
I've inherited an Access database used to assign topics to individuals. The table we pull the relationship from is formatted thus:

ID 100
RegID 999
TopicID 5
ID 101
RegID 909
TopicID 3
ID 102
RegID 999
TopicID 3
ID 103
RegID 909
TopicID 2

There will be several records for each RegID. My problem is identifying those that DID NOT choose a particular Topic ID. Say 2 for example.

A simple query gives me a list of all records that are not TopicID = 2. But I need to know the RegID records that did not choose TopicID = 2 at all.
 
you mean it's like:
[tt]
ID RegID TopicID
100 999 5
101 909 3
102 999 3
103 909 2[/tt]

maybe something like:
Code:
SELECT * FROM tableName WHERE RegID not in (SELECT RegID from tableName Where TopicID = 2)

Leslie

In an open world there's no need for windows and gates
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top