ソースコード
with PROCESS_LIST(PROSESS) as(
    select
        PROCESS_ID
    from PROCESS_LOG
    GROUP BY PROCESS_ID
), TMP(PROCESS, CNT) as(
    select
        PROCESS
        , case
                when cast(substr(PROCESS,5,1) as int)=sum(FLAG) over(partition by SESSION_ID order by EX_TIMESTAMP rows between unbounded preceding and current row) then 1
                else 0
            end as CNT
    from (select
            PROCESS_ID as PROCESS
            , SESSION_ID
            , EX_TIMESTAMP
            , case
                when 
                    cast(substr(PROCESS_ID,5,1) as int)=rank() over(partition by SESSION_ID order by EX_TIMESTAMP) then 1
                else 0
            end as FLAG
        from PROCESS_LOG)
)

select
    L.PROSESS as PROCESS
    , IFNULL(SUM(T.CNT), 0)as CNT
from PROCESS_LIST as L
left outer join TMP as T
    on L.PROSESS=T.PROCESS
group by L.PROSESS
order by L.PROSESS asc;
提出情報
提出日時2024/06/30 22:33:18
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者poapoa1010
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量86 MB
メッセージ
テストケース(通過数/総数)
3/4
状態
メモリ使用量
データパターン1
AC
84 MB
データパターン2
AC
84 MB
データパターン3
WA
86 MB
データパターン4
AC
83 MB