Created
September 3, 2014 15:21
-
-
Save thomasdarimont/4247d16acdc57504e00c 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
copy( | |
with | |
base_data as | |
( | |
select | |
alm.* | |
, dd.day | |
, dd.hour | |
, dd.minute | |
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 | |
, min(bd.household_id) as household_id | |
, min(bd.plug_id) as plug_id | |
from base_data bd | |
group by | |
bd.house_id | |
,bd.day | |
,bd.hour | |
,bd.minute | |
) | |
to 'D:\\development\\projects\\xd-keynote\\load_test\\agg_load_min_by_h.csv' CSV |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Query returned successfully: 40120 rows affected, 5989 ms execution time.