1
votes

I want to vertically merge two tables by one similar column with multiple duplicates values. I tried using join but it merged with many to many values but in my case I need simple merge to prepare a file.

Example:

example

1
Try to put some of your code which you tried. So we can easily understand where you exactly struct..Shoshana
Also, which RDBMS are you using? And do you expect to do the job in SQL or in Python (since you tagged both)?gimix
Query is like this SELECT a.x, a.y, b.z FROM table1 a JOIN table2 b ON a.x =b.x I am using Oracle SQL, I tagged Python if there is any way to perform this operation in PYthon alsoSamarth Khandelwal

1 Answers

0
votes

This answers the original version of the question.

This looks like a full join. In standard SQL:

select coalesce(t1.x, t2.x) as x, t1.y, t2.z
from table1 t1 left join
     table2 t2
     on t1.x = t2.x and t1.y = t2.z;