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

megha307
megha307 Partner, Registered Posts: 1 Partner

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

Answers

  • Vitaliy
    Vitaliy Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer Posts: 102 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

Setup Info
    Tags
      Help me…