SQL Query to convert single row from multiple tables into single row in a table

I have a scenario like Have 7 tables. All these 7 tables have same metadata structure and also all have 2 columns. In that, One column is same in all 7 tables (Joining column, But not a primary column) and another column has different values.
Below have a example for 2 tables. How can we achieve for 7 tables?
Tab1
====
loc_name mem_name
HYD RAJU
HYD MOHAN

Tab2
====
loc_name mem_name
HYD RAVI
HYD MOHAN

OUTPUT:
========
loc_name mem_exist1 mem_exist2
HYD RAJU NULL
HYD NULL RAVI
HYD MOHAN MOHAN

Showing Answers 1 - 4 of 4 Answers

Shrushti

  • Jul 20th, 2016
 

Code
  1.  

  Was this answer useful?  Yes

Laxmi

  • Aug 5th, 2016
 

Code
  1.  

  Was this answer useful?  Yes

Pavan

  • Oct 1st, 2016
 

Hi use sub-query with left join

  Was this answer useful?  Yes

Tmas

  • Nov 3rd, 2016
 

Use outer join

Code
  1.  

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions