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

Filling in query gap 1

Status
Not open for further replies.

jmob

Programmer
Jun 21, 2005
58
US
I have two tables: A & B.

Table A:
ID(Primary Key) | Type
001 A
002 B
003 C

Table B:
ID(this contains duplicates) | Origin(not imptnt.)
001 ZZ
001 YY
001 XX
002 NN

I need to add on the type column onto table B (preferably just a query). For each ID in table B, I need to look up the ID in table A and return the corresponding type. Help is EXTrEMEly appriciated! What the output needs to look like is:

Needed Query Table:
ID | Origin | Type
001 ZZ A
001 YY A
001 XX A
002 NN B
 
Have a look at JOINs and RelationShips:
SELECT B.ID, B.Origin, A.Type
FROM [Table B] B INNER JOIN [Table A] A ON B.ID = A.ID

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top