ソースコード
with tmp_tbl_1 as (
select 
*
,'STEP' || row_number() over(partition by session_id order by ex_timestamp) as order_
from process_log 
)
,tmp_tbl_2 as (
select 
  *
  ,case when process_id = order_ then 'ok' else 'ng' end as check_
from tmp_tbl_1 
)
,tmp_tbl_3 as (
select * 
  ,sum(case when check_ = 'ng' then 1 when check_ = 'ok' then 0 else 1/0 end) over(partition by session_id order by ex_timestamp) as cum_ng
from tmp_tbl_2
)
select 
  process_id as PROCESS 
  ,count(session_id) as CNT
from tmp_tbl_3
where cum_ng = 0
group by 1 
order by 1 
;
提出情報
提出日時2023/12/18 16:08:04
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者hattsuriboy
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量89 MB
メッセージ
テストケース(通過数/総数)
3/4
状態
メモリ使用量
データパターン1
AC
87 MB
データパターン2
AC
85 MB
データパターン3
AC
89 MB
データパターン4
WA
85 MB