ソースコード
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(no) as minno
    from tmp1
    where flag=0
    group by session_id
    order by session_id
),
tmp3 as (
    select
        tmp1.session_id,
        tmp1.process_id,
        case 
            when tmp2.session_id=tmp1.session_id and cast(substr(tmp1.process_id,5,1) as int)>=minno then 0
            else 1
        end flag1,
        tmp1.no,
        flag
    from tmp1
    left outer join tmp2
    on tmp1.session_id=tmp2.session_id
    where flag1=1
)
select 
    process_id as PROCESS,
    count(session_id) as CNT
from tmp3
group by process_id
order by process;
提出情報
提出日時2024/12/23 22:18:16
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者kate
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量88 MB
メッセージ
テストケース(通過数/総数)
3/4
状態
メモリ使用量
データパターン1
AC
86 MB
データパターン2
AC
88 MB
データパターン3
AC
87 MB
データパターン4
WA
86 MB