ソースコード
WITH SUB1 AS (SELECT SESSION_ID, PROCESS_ID,
RANK() OVER(PARTITION BY SESSION_ID ORDER BY EX_TIMESTAMP) AS RANK
FROM PROCESS_LOG
ORDER BY SESSION_ID),
SUB2 AS (SELECT SESSION_ID,
MIN(RANK) - 1 AS MIN
FROM SUB1
WHERE CAST(SUBSTR(PROCESS_ID, 5, 1) AS INTEGER) != RANK
GROUP BY SESSION_ID)
SELECT PROCESS_ID AS PROCESS,
COUNT(DISTINCT CASE WHEN CAST(SUBSTR(SUB1.PROCESS_ID, 5, 1) AS INTEGER) < SUB2.MIN
OR SUB2.MIN IS NULL
THEN SUB1.SESSION_ID END) AS CNT
FROM SUB1
LEFT JOIN SUB2
ON SUB1.SESSION_ID = SUB2.SESSION_ID
GROUP BY PROCESS_ID
ORDER BY PROCESS_ID
提出情報
提出日時2024/06/20 23:18:22
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者yanagiguchi
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量86 MB
メッセージ
テストケース(通過数/総数)
0/4
状態
メモリ使用量
データパターン1
WA
84 MB
データパターン2
WA
83 MB
データパターン3
WA
86 MB
データパターン4
WA
83 MB