sql - BigQuery - Run Query per Table -


big query allows separate tables via timestamp using table_query. here's example query using:

select   count(*) num (   select     dsn,     sum(hours_used) total_hours       [device_use.day20150901] // - 1 day       nest_state > 5   group     dsn )   total_hours > 1 

now want do, run same query, on per table day basis. ie, [device_use.day20150901], [device_use.day20150902], [device_use.day20150903], etc.

is possible, or have make separate table single query.

thanks!

just added few things original query, assuming existence of timestamp field being within respective table's day

select   day,                                          -- added   count(*) num (   select     date(your_timestamp_field) day,          -- added     dsn,     sum(hours_used) total_hours        (table_date_range(device_use.day,          -- added                     timestamp('2015-09-01'),    -- added                     timestamp('2015-09-29')))   -- added       nest_state > 5   group     1,                                          -- added     2 )   total_hours > 1 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -