1

I have one hive table with schema Name ,Contact,Address,Subject

Name  Contact   Address  Subject
abc   1111      Mumbai    maths
egf   2222      nashik    science
pqr   3333      delhi     history

And other table with schema **Name ,Contact** 
Name   Contact
xyz    4444  
mno    2222 

Expected Output

Name  Contact   Address  Subject
abc   1111      Mumbai    maths
pqr   3333      delhi     history
xyz   4444      null      null
mno   2222      nashik    science

I have tried join operation but not able get correct output

vishal
  • 25
  • 8

1 Answers1

0

Use full join:

select coalesce(t2.name,t1.name) as name, 
       coalesce(t2.contact, t1.contact) as contact,
       t1.address, t1.subject
  from table1 t1
       full join table2 t2
                 on t1.contact=t2.contact
leftjoin
  • 36,950
  • 8
  • 57
  • 116