Interfaith
Interfaith

Reputation: 145

Choosing criteria in Access

I have two excel files that I linked together to make a Query in Access.

Table One     Table Two
Name  ID      Name   ID
John  342     John   342
Mike  234     Mike   234
Mich  980     Mich   980
Jenn  098     Quay   309
Anna  145     Pond   612
              Lope   546
              Anna   145

How do i set the criteria in the access query so that they match the ID and only show me the names on the left matching the right. Anything from table two that doesn't match with table one to disregard?

If I have the following query:

Name          Name
Table one     Table two

I get the following result:

John   John
Mike   John
Mich   John
Jenn   John
Anna   John
John   Mike
Mike   Mike
Mich   Mike
Jenn   Mike
Anna   Mike

and so forth... So i am figuring i have to set a criteria... which is where i am stuck at... any help would be appreciative.

Upvotes: 0

Views: 104

Answers (1)

Fionnuala
Fionnuala

Reputation: 91356

You can use an INNER JOIN:

 SELECT [Table 1].Name, [Table 2].Name 
 FROM [Table 1] 
 INNER JOIN [Table 2]
 ON [Table 1].Name = [Table 2].Name 

You can create this query in MS Access by adding both tables to the query design window and then dragging the field you want to match from one table to the next or by switching to SQL view and typing or pasting SQL.

More information:
Fundamental Microsoft Jet SQL for Access 2000
Intermediate Microsoft Jet SQL for Access 2000
Advanced Microsoft Jet SQL for Access 2000

Upvotes: 1

Related Questions