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

Select Query - Across two tables

Status
Not open for further replies.

nemmeh

Technical User
Jul 7, 2003
30
US
Hey guys, need a little additional help with a select query.

Basic Rundown:
I have a (2) tables, Voters and POC. The Voters and POC tables have varying different fields. However, some of the fields match up that I would like to do a select query for.

Fields:
LastName
FirstName
DateofBirth
Sex

Basically, what I'm trying to accomplish is I need to eliminate from the voters table any records(People) that are listed in the POC table.

Since multiple people are going to have the same last name, I can't do the query on one field alone.

Can anyone help in constructing a select query, I just want to select the records right now. I'll delete them once I see how many people from the POC table are listed in the Voters table.

So I think I'm asking for this basically...

Select * FROM [VOTERS] where lastname,firstname,sex,dateofbirth IN (SELECT lastname,firstname,sex,dateofbirth from [POC]);

I know the syntax is wrong for doing multiple fields, so can someone help me out with that please?

Thanks for any help you can give... :)
 
Dear nemmeh,

In Access,
1. Create a new query in Design view.
2. Add the two tables to the view.
3. For each field that matches up, drag the field in one table to the matching one on the other.

Once you are completed, according to your question above, you should have 4 lines running between the two tables. What this will do is select only those rows that match up exactly between both tables on all four fields.


Good luck,

Heather



[yinyang] [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top