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

Creating a table that will do this....

Status
Not open for further replies.

Zunn

Technical User
Jun 21, 2002
9
GB
I have two tables which are of different recordset, A and B. Both tables have a similar field ReferenceNumber.

TableA contains miscellanous information
TableB contains the Name and Address fields.

I would like to create a table/query where it would show me

ID Name Addresss Information
xx xx xxxxxxxxxxx xxxxxxx

Bearing in mind that I would this table/query should only show matching ReferenceNumber found in TableA and TableB.

Does this make sense?
 
It sounds like what you are after is an inner join. An inner join between two tables only returns matching records. This is in contrast to an outer join which can return all records from one table as well as any records that happen to match in another table.

I would try the following:
[tt]
SELECT TableA.ID, Name, Address, Information
FROM TableA INNER JOIN TableB
ON TableA.ID=TableB.ID
[/tt]
The reason why I qualified the field ID in the select statement is because that field exists in more than one table. You have to tell access which table its in.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top