ソースコード
WITH T1 AS(
SELECT
    *
    ,NTH_VALUE(PROCESS_ID,1)OVER(PARTITION BY SESSION_id ORDER BY EX_TIMESTAMP ASC)AS N1_TIME
    ,NTH_VALUE(PROCESS_ID,2)OVER(PARTITION BY SESSION_id ORDER BY EX_TIMESTAMP ASC)AS N2_TIME
    ,NTH_VALUE(PROCESS_ID,3)OVER(PARTITION BY SESSION_id ORDER BY EX_TIMESTAMP ASC)AS N3_TIME
    ,NTH_VALUE(PROCESS_ID,4)OVER(PARTITION BY SESSION_id ORDER BY EX_TIMESTAMP ASC)AS N4_TIME
    ,NTH_VALUE(PROCESS_ID,5)OVER(PARTITION BY SESSION_id ORDER BY EX_TIMESTAMP ASC)AS N5_TIME


FROM
    PROCESS_LOG
),T2 AS (
    SELECT
        *
    FROM
        T1
    WHERE
        N1_TIME='STEP1'
        AND 
        (N2_TIME='STEP2' OR N2_TIME IS NULL)
        AND
        (N3_TIME='STEP3' OR N3_TIME IS NULL)
        AND
        (N4_TIME='STEP4' OR N4_TIME IS NULL)
        AND
        (N5_TIME='STEP5' OR N5_TIME IS NULL)
)

SELECT
    PROCESS_ID,COUNT(DISTINCT SESSION_id)AS CNT
FROM
    T2
GROUP BY
    PROCESS_ID
ORDER BY 
    PROCESS_ID ASC
提出情報
提出日時2023/12/18 11:03:44
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者19820314
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量94 MB
メッセージ
テストケース(通過数/総数)
0/4
状態
メモリ使用量
データパターン1
WA
94 MB
データパターン2
WA
86 MB
データパターン3
WA
91 MB
データパターン4
WA
86 MB