ソースコード
with 
PROCESS_LOG_ORD as(
select * from PROCESS_LOG order by 1,4
),
ORD as (
select SESSION_ID, 
--PROCESS_ID
group_concat(replace(PROCESS_ID,"STEP",""),"") as ord
from PROCESS_LOG_ORD
group by 1),
tmp as(
select 
count(1) as CNT,
case
--when ord = "123456" then "6"
when ord = "12345" then "5"
when ord like "1234%" then "4"
when ord like "123%" then "3"
when ord like "12%" then "2"
when ord like "1%" then "1"
else "0"
end as steps
from ORD
group by steps
order by steps
),
ans as(
select steps, "STEP"||steps as PROCESS, 
CNT from tmp where steps !="0"
),
stepindex as (
SELECT "1" AS value
    UNION ALL
    SELECT "2"
    UNION ALL
    SELECT "3"
    UNION ALL
    SELECT "4"
    UNION ALL
    SELECT "5"
    --UNION ALL 
    --SELECT "6"
)
select "STEP"||stepindex.value as PROCESS,
case
when ans.CNT is NULL then 0
else ans.CNT
end as CNT
from stepindex left join ans on stepindex.value = ans.steps
提出情報
提出日時2024/06/15 12:00:55
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者nagisa5101
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量86 MB
メッセージ
テストケース(通過数/総数)
0/4
状態
メモリ使用量
データパターン1
WA
86 MB
データパターン2
WA
84 MB
データパターン3
WA
85 MB
データパターン4
WA
84 MB