Working with Access

S

Saraladevi

In Access i have two tables seperately, how to consolidate into one? can
anybody help my mobile no is 9380586696.

Thanx & Rgrds,
Saraladevi.E.
 
D

Douglas J. Steele

Consolidate into one how? Do you mean table 1 is

A 1 2
A 2 2

and table 2 is

B 2 3
B 3 5

and you want

A 1 2
A 2 2
B 2 3
B 3 5

or do you mean table1 is

A 1 2
A 2 3
C 1 4

and table 2 is

A 234
B 345
C 456

and you want

A 1 2 234
A 2 3 234
C 1 4 456

For the first case, you'd use a Union query:

SELECT Field1, Field2, Field3
FROM Table1
UNION
SELECT Field1, Field2, Field3
FROM Table2

For the second case, you'd use a join:

SELECT Table1.Field1, Table1.Field2, Table1.Field3, Table2.Field2
FROM Table1 INNER JOIN Table2
ON Table1.Field1 = Table2.Field2
 
Top