ソースコード
with tmp as (
    select 
        SESSION_ID,
        process_id,
        rank() over(partition by SESSION_ID order by EX_TIMESTAMP ) as NO
    from process_log
),
tmp1 as (
    select
        SESSION_ID,
        process_id,
        no,
        case 
            when process_id='STEP1' and NO=1 then 1
            when process_id='STEP2' and NO=2 then 1
            when process_id='STEP3' and NO=3 then 1
            when process_id='STEP4' and NO=4 then 1
            when process_id='STEP5' and NO=5 then 1
            else 0
        end as flag
    from tmp
),
tmp2 as (
    select 
        session_id,
        min(process_id) as minid,
        no
    from tmp1
    where flag=0
    group by session_id
),
tmp3 as (
    select
        tmp1.session_id,
        process_id,
        case 
            when tmp2.session_id=tmp1.session_id and tmp1.process_id>=minid then process_id
        end flag1,
        tmp1.no,
        flag
    from tmp1
    left outer join tmp2
    on tmp1.session_id=tmp2.session_id
    and tmp1.process_id>tmp2.minid
    where flag=1 and flag1 is null
)
select 
    process_id as PROCESS,
    count(session_id) as CNT
from tmp3
group by process_id
order by process;
提出情報
提出日時2024/07/07 20:32:08
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者kate
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
3/4
状態
メモリ使用量
データパターン1
AC
83 MB
データパターン2
AC
84 MB
データパターン3
AC
85 MB
データパターン4
WA
84 MB