BigQuery - combine tables
2 answers
you can use the following syntax
SELECT Date, Name, Amount, Value, Type_of_Good
FROM
(select Date, Name, Amount, Value, Type_of_Good from january ...),
(select Date, Name, Amount, Value, Type_of_Good from february ...),
...
(select Date, Name, Amount, Value, Type_of_Good from december ...)
+3
source to share
The Pentium10 proposal works, but you can also consider two other options:
- Use
TABLE_QUERY()
(described here) which will allow you to build a query that selects from multiple tables. - Use the view ( described here ). Please note that views cannot be used with
TABLE_QUERY
orTABLE_DATE_RANGE
at this time (although this feature should be coming soon!). But the view will allow you to take the query suggested by the Pentium10 and save it so that it looks like a separate table. - Use a copy of a record-for-record table to copy individual tables into the PivotTable of the year. While this will mean that you will receive storage fees for the new table, it will also allow you to drop the old tables if you no longer need them, and be the most flexible option since then you have a real table with combined data.
+4
source to share