Reputation: 33
I'm guessing this is very simple but I'm totally new to this. Could you please help to join these 3 or more tables with the same column name into one large table. Examples given below. I have table 2017 to 2019 and the resultant image at the bottom is what I am trying to get.
What is the SQL BigQuery code for this? Thanks!
--------WHAT I AM TRYING TO ACHIEVE ---------------
Upvotes: 0
Views: 3571
Reputation: 1269623
I'm pretty sure you want union all
:
select t.*
from table_2017 t
union all
select t.*
from table_2018 t
union all
select t.*
from table_2019 t;
The use of t.*
is a convenience, assuming the tables have the same names, in the same order with compatible types. I recommend listing the columns explicitly.
Note: You should probably fix your data model. Having multiple tables with the same columns is not a good data model. All this data should be in one table.
Upvotes: 1