View Full Version : A LIST FROM TWO TABLES


danaleblanc
03-08-2002, 04:56 PM
I’ve got two tables – Spanish one and Spanish two
Spanish one’s fields are: student id (autonumber), name (text), joined (yes/no)
Spanish two’s fields are: student id (autonumber), name (text), joined (yes/no)
I want a list of anyone who has joined that Spanish club.
Did query and added both tables
Used the names and joined fields from each table.
Added, “yes” in the criteria row.
Say I have five names in Spanish one who have joined and ten names in Spanish two who have joined.
When I run the query it gives the wrong total.
It just puts extra names in Spanish one to equal Spanish two.
Any help is appreciated.

Shep
03-08-2002, 05:26 PM
Looks as though a Union (ALL) query is your answer.

Shep

danaleblanc
03-08-2002, 05:33 PM
okay, how do I do that?

Pat Hartman
03-08-2002, 06:53 PM
Before you go too much further with this, I suggest that you change your tables. You have a many-to-many relationship between students and clubs. I presume a student may join more than a single club if he wishes. What about other clubs? May this system need to expand to handle them also? You need a table to hold student information. A second to hold club information and a third to connect the two.

tblStudent:
StudentId (primary key)
FirstName
LastName
other fields

tblClub:
ClubId (primary key)
ClubName
other fields

tblClubStudent
StudentId (primary key field 1)
ClubId (primary key field 2)

Use a subform on either the Student or Club (or both) main form to enter the data in the relation table.

danaleblanc
03-09-2002, 11:32 AM
Thanks