URGENT help please

123James

Registered User.
Local time
Yesterday, 22:18
Joined
May 15, 2006
Messages
60
hi everyone

urgent help needed with creating a query please...

I have a table with AutoNumber as primary key.
The second column is called ClassID and the third column is called TeacherID.
I want to run a select query that finds all records where the ClassID column and TeacherID column match.
Basically I want to find records where the fields are duplicated.

How do I do this either through Access query builder or SQL view?

Thanks in advance
 
Hi -

If you have a situation where a ClassID (identifying a particular class) may or may not match a particular teacher (one teacher may teach many classes -- one classname may be taught by many teachers), there's a definite structural problem that needs to be addressed.

Bob
 
thanks for the reply, but what i REALLY need to know is if it is possible to create this query!

The issues with the structure of the database are a result of the method of data capture used to update the database. I am well aware of these but there is little i can do about them!
 
Assuming a teacher and a class have the same ID. You can put
Code:
=[ClassID]
in the TeacherID criteria of the query grid.

Col
 
The teacher ID and class ID are different. Each are primary keys in other tables (class.tbl and teacher.tbl)
 
SELECT Class.ClassID, Teacher.TeacherID AS Expr1
FROM Class, Teacher INNER JOIN Class ON Teacher.TeacherID = Class.ClassID;

I think this is what you're trying to do? You might have to experiment with this a little.

123James said:
The teacher ID and class ID are different. Each are primary keys in other tables (class.tbl and teacher.tbl)
Now, I'm confused. The TeacherID and ClassID you're trying to compare are in the same table?

Edit:

Then,

SELECT Table.TeacherID, Table.ClassID, Table.AutoNumber
FROM Table
WHERE Table.TeacherID = Table.ClassID;

something along those lines.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom