Created
September 3, 2014 15:54
-
-
Save thomasdarimont/bfd110dd3025adfa818b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with | |
base_data as | |
( | |
select | |
alm.* | |
, dd.day | |
, dd.hour | |
, dd.minute | |
, dd.hourminute | |
from | |
agg_load_min_by_h_hh_p alm | |
inner join | |
dim_date dd | |
on | |
alm.ts = dd.ts | |
) | |
select | |
row_number() over() as id | |
, min(bd.ts) as ts | |
, sum(bd.value) as value --sum of avg(...) | |
, max(bd.property) as property | |
, bd.house_id | |
, bd.household_id | |
, bd.plug_id | |
from base_data bd | |
group by | |
bd.house_id | |
,bd.household_id | |
,bd.plug_id | |
,bd.day | |
,bd.hour | |
,bd.hourminute |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment