Skip to content

Instantly share code, notes, and snippets.

@guyernest
Created May 18, 2019 16:13
Show Gist options
  • Select an option

  • Save guyernest/b70ddd3979ee6cd2ea610f3892d76e31 to your computer and use it in GitHub Desktop.

Select an option

Save guyernest/b70ddd3979ee6cd2ea610f3892d76e31 to your computer and use it in GitHub Desktop.
Forecast Pipeline 07
select * from
(select cast(category as integer) as item_num_history, date_trunc('day', calendar_date) as sales_day, sum(sales) as demand
from forecast.compressed_data group by 1,2) as a
right join
(select *, date_trunc('day', from_iso8601_timestamp(date)) as forecast_day, cast(item_id AS integer) as item_num_forecast
from forecast.output_train_1217_category) as b
on a.sales_day = b.forecast_day AND a.item_num_history = b.item_num_forecast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment