Bigquery, how to query multiple tables of the same structure?

I have datasets of the same structure, and I know that I can query them like that, they are named by date:

SELECT column
FROM [xx.ga_sessions_20141019] ,[xx.ga_sessions_20141020],[xx.ga_sessions_20141021] 
WHERE column = 'condition';

However, I really want to request different months of this data ... so instead of listing them all the same way as described above, there is a syntax that you can use that looks like this:

SELECT column
FROM [xx.ga_sessions_201410*] ,[xx.ga_sessions_201411*]
WHERE column = 'condition';
+4
source share
1 answer

Look at the wildcard options in the query section of the BigQuery query. TABLE_DATE_RANGEor TABLE_QUERYwill work for you here. Sort of:

SELECT column
FROM TABLE_DATE_RANGE(xx.ga_sessions_,
                      TIMESTAMP('2014-10-19'),
                      TIMESTAMP('2014-10-21'))
WHERE column = 'condition';
+6
source

All Articles