I have two databases with similar data. I want to do a join the same tables from each database into one result set. If I do a union, everything seems to be ok except I am getting duplicate records if one field is updated in one table. For example
Table 1
id name address
10 jack 123 Vine
20 john 456 State
30 joe 678 Main
Table 2
id name address
10 jack 458 Beach
20 john 456 State
30 joe 678 Main
40 mary 999 Hubble
The result set from
select * from table1
UNION
select * from table2
is
id name address
10 jack 123 Vine
10 jack 458 Beach
20 john 456 State
30 joe 678 Main
40 mary 999 Hubble
Is there a way just to match on the id field and not every field in the table? So I would get a result set like
id name address
10 jack 123 Vine
20 john 456 State
30 joe 678 Main
40 mary 999 Hubble
????
Table 1
id name address
10 jack 123 Vine
20 john 456 State
30 joe 678 Main
Table 2
id name address
10 jack 458 Beach
20 john 456 State
30 joe 678 Main
40 mary 999 Hubble
The result set from
select * from table1
UNION
select * from table2
is
id name address
10 jack 123 Vine
10 jack 458 Beach
20 john 456 State
30 joe 678 Main
40 mary 999 Hubble
Is there a way just to match on the id field and not every field in the table? So I would get a result set like
id name address
10 jack 123 Vine
20 john 456 State
30 joe 678 Main
40 mary 999 Hubble
????