You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add SQL parser support for the remaining (complicated) cases for the CREATE OR REPLACE command in Snowflake.
CREATE OR REPLACE table metrics.combined_monthly_tmp AS ( with acct_summary AS (
SELECT
u.eom_date,
u.parent_id,
FROM metrics.usage_monthly u
)
, pivot_summary AS (
SELECT
p.*
FROM summary a
PIVOT (SUM(a.usage) FOR a.inv_item_type IN ('item1', 'item2', 'item3')) AS p
(eom_date, parent_id)
)
SELECT
cc.eom_date,
parent_id,
ROUND(NVL(u.item1, 0), 2) item1_amt,
ROUND(NVL(u.item2, 0), 2) item2_amt,
ROUND(NVL(u.item_3, 0), 2) item3_amt,
FROM pivot_summary u
FULL JOIN metrics.usage_monthly c
USING (parent_id, eom_date)
LEFT JOIN commons.calendar cc
ON cc.date = NVL(u.eom_date, c.eom_date)
ORDER BY
parent_id,
c.eom_date)
The text was updated successfully, but these errors were encountered:
Add SQL parser support for the remaining (complicated) cases for the CREATE OR REPLACE command in Snowflake.
The text was updated successfully, but these errors were encountered: