0

I have 2 views with columns,

view1 = (ID, Number)
view2 = (ID, Number, Name)

How to create select display such that

Display = (ID, Number, Name)

and Display is the FULL OUTER JOIN view1 and view2.

pnkjmndhl
  • 565
  • 3
  • 7
  • 21
  • I reject the premise of the question ;-). Why do you have views – Strawberry Sep 13 '17 at 21:15
  • @Strawberry the two different views are the simplified forms of multiple tables. Now, I need to join them. – pnkjmndhl Sep 13 '17 at 21:17
  • @pnkjmndhl You join them the same way you join ordinary tables. That's one of the points of using views, you can (mostly) treat them like tables. – Barmar Sep 13 '17 at 22:09
  • @barmar The only problem is that MySQL doesnot support Full outer join for views. – pnkjmndhl Sep 13 '17 at 22:11
  • @pnkjmndhl It doesn't support full outer join for tables, either. You emulate it for views the same way you emulate it for ordinary tables. – Barmar Sep 13 '17 at 22:12

1 Answers1

2
SELECT view2.*
FROM   view1
       LEFT JOIN view 2
           ON view1.id = view2.id
UNION

SELECT view2.*
FROM   view1
       RIGHT JOIN view 2
           ON view1.id = view2.id
SE1986
  • 2,534
  • 1
  • 10
  • 29