I am currently having to simulate a full outer join on two tables (right outer + left outer), and the use a union to get rid of the duplicates.
I was wondering, because I have many tables to do this to, and I want to end up with a single table in the end, is there a better way to do this.
This is what I'm currently doing:
create table `table+left` as(
select table1.col1, table1.col2, table1.col3, table2.col2 as `alias`
from table1
left outer join table2
on table1.col1 = table2.col1
);
create table `table+right` as(
select table1.col1, table1.col2, table1.col3, table2.col2 as `alias`
from table1
right outer join table2
on table1.col1 = table2.col1
);
create table `table1+table2` as
select * from `table+left`
union
select * from `table+right`;