blob: d17d67a33d90e75c88ee9e357e90b56f40612a6b [file]
EXECUTE STATEMENT SET BEGIN
INSERT INTO window_totals
SELECT hotel_id,stay_date,window_minutes,window_start,window_end,
row_sign*nights,row_sign*revenue_cents,row_sign*channel_nights,row_sign*channel_revenue_cents
FROM contributions;
INSERT INTO baseline
SELECT hotel_id,stay_date,window_minutes,window_start,window_end,
SUM(row_sign*nights),SUM(row_sign*revenue_cents),SUM(row_sign*channel_nights),SUM(row_sign*channel_revenue_cents)
FROM contributions
GROUP BY hotel_id,stay_date,window_minutes,window_start,window_end;
END;