ソースコード
with a as (select MONTHLY, NEW_MRR +EXPANSION_MRR -DOWNGRADE_MRR - CHURN_MRR as one from MRR_DATA order by MONTHLY)

select YM, ifnull(MRR, 0) as MRR from (select MONTHLY as YM from MRR_DATA)
FULL outer join (

select * from
(select MONTHLY as YM_m,date(MONTHLY,'+1 month') as YM from MRR_DATA)
left outer join (

select MONTHLY as YM_m, ifnull(sum, 0) as MRR
from 
(select a1.MONTHLY, a1.one, sum(a2.one) as sum
FROM   a a1
left outer JOIN a a2
ON  a1.MONTHLY >= a2.MONTHLY
GROUP BY a1.MONTHLY,a1.one
ORDER BY a1.MONTHLY)

) using (YM_m)
) using (YM)
提出情報
提出日時2023/02/19 19:23:49
コンテスト第5回 SQLコンテスト
問題MRRの集計
受験者Tomii9273
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量86 MB
メッセージ
テストケース(通過数/総数)
3/3
状態
メモリ使用量
データパターン1
AC
80 MB
データパターン2
AC
86 MB
データパターン3
AC
84 MB