I want to merge two tables using UNION but getting common primary key twice that i dont want. -

megha307
Level 1
I want to merge two tables using UNION but getting common primary key twice that i dont want. -

I want to merge two tables using UNION but getting common primary key twice that i dont want. - I want one occurrence of primary key .

Example :

Table 1                                                                                                                   Table 2          

Id Name Country                                                                                           Id Name Country

1 Ed          England                                                                                            2   Megha  India

2 Megha  India                                                                                                  3    Ved      Germany

3 Ved         Germany                                                                                        4    Ram     Japan

 

Desired Output:

Id Name Country

1 Ed          England                                                                                          

2 Megha  India                                                                                                

3 Ved         Germany 

4    Ram     Japan

 

0 Kudos
1 Reply
VitaliyD
Dataiker

Hi,

Could you share the query you are using (a screenshot of the query and output will be the best)? I suspect you are using UNION ALL, so the duplicates are kept. UNION should combine the tables into a distinct single result.

Best

0 Kudos