Querying multiple tables in Big Query
One SQL query can reference multiple tables. Just separate each table with a comma in the FROM clause to query across all mentioned tables.
You can also use a Table Wildcard Function. Here's one example from the docs for StandardSQL:
SELECT
name
FROM
mydata.people
WHERE
age >= 35
AND
(_TABLE_SUFFIX BETWEEN '20140325' AND '20140327')
And here's a similar example for LegacySQL (docs).
SELECT
name
FROM
(TABLE_DATE_RANGE([mydata.people],
TIMESTAMP('2014-03-25'),
TIMESTAMP('2014-03-27')))
WHERE
age >= 35
This will query the tables:
- mydata.people20140325
- mydata.people20140326
- mydata.people20140327
There are a few other options on the docs. I'd recommend checking them out.