Query that shows a limited no. of records

P

punkyfire

Hi. I am new to access and need help with the following.

I have 2 tables.

Table 1 has 20 records in a single field with a tracking no.
Table 2 1 has 943 records with 8 fields of which, the 7th field contains the
tracking no.
I have established a relationship between Table 1, field 1 and Table 2,
Field 7.

I want to write a query that shows the records for only the 20 records
listed in table 1, but with the complete 8 fields from table 2.

Can anyone help?
 
K

Klatuu

So which of the 943 records do you want to show?
If you have only 20 tracking numbers, that means there are an average of
about 47 records in table 2 for each of the records in table 1.

What, exactly, are you trying to do?
 
P

punkyfire

Hi. I am trying to get a list of the 20 records in Table 2 that match the
tracking no. in Table 1. Does that make sense?
 
K

Klatuu

Not really...
You said table 1 has 1 field and 20 records (I think)
So do you mean you want to select a tracking number from table 1 and return
the 20 records in table 2 that match that tracking number?
How do you know you will get 20 records?

Sorry, but a bit more detail would be helpful.
 
P

punkyfire

Table 1 has 1 field and 20 records (unique tracking nos.). Table 2 has 8
fields and 900+ records. Field 7 of Table 2 contains the unique tracking
nos. -- 20 of which are found in Table 1. I want to do a query that will
pull only the records from Table 2 that match the 20 unique tracking numbers
found in Table 1.

Does that make sense.
 
C

Chris2

punkyfire said:
Table 1 has 1 field and 20 records (unique tracking nos.). Table 2 has 8
fields and 900+ records. Field 7 of Table 2 contains the unique tracking
nos. -- 20 of which are found in Table 1. I want to do a query that will
pull only the records from Table 2 that match the 20 unique tracking numbers
found in Table 1.

Does that make sense.


Mary,

SELECT T2.[field 1]
,T2.[field 2]
,T2.[field 3]
,T2.[field 4]
,T2.[field 5]
,T2.[field 6]
,T2.[field 7]
,T2.[field 8]
FROM [Table 1] AS T1
INNER JOIN
[Table 2] AS T2


Sincerely,

Chris O.
 
C

Chris2

Mary,

SELECT T2.[field 1]
,T2.[field 2]
,T2.[field 3]
,T2.[field 4]
,T2.[field 5]
,T2.[field 6]
,T2.[field 7]
,T2.[field 8]
FROM [Table 1] AS T1
INNER JOIN
[Table 2] AS T2


Sincerely,

Chris O.

I missed a line:

SELECT T2.[field 1]
,T2.[field 2]
,T2.[field 3]
,T2.[field 4]
,T2.[field 5]
,T2.[field 6]
,T2.[field 7]
,T2.[field 8]
FROM [Table 1] AS T1
INNER JOIN
[Table 2] AS T2
ON T1.[field 1] = T2.[field 7]


Sincrerely,

Chris O.
 
Top