I have 20+ supporting tables created as follows.
[common_column1, common_column2, unique_column]
I need to create a combo table or view that will be customized this way
[common_column1, common_column2,
table1_unique_column, table2_unique_column, table3_unique_column, etc...]
I have 6 million records in each supporting table. My combined query to create a table / view is as follows:
select
a.common_column1, a.common_column2, a.unique_column, b.unique_column,
c.unique_column, d....
into combined_table
from table1 as a
left join table2 as b on (a.common_column1 = b.common_column1 and a.common_column2 = b.common_column2)
left join table3 as c on (a.common_column1 = c.common_column1 and a.common_column2 = c.common_column2)
left join table4 as d ...`
- /, . , : , ? - ?