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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -