ソースコード

with out as (
select a.*
from process_log as a
inner join process_log as b
on a.session_id = b.session_id
and a.ex_timestamp  < b.ex_timestamp
and cast(substr(a.process_id,5,1) as int) -1  = cast(substr(b.process_id,5,1) as int)
)

,seiki as (
select a.*
from process_log as a
inner join process_log as b
on a.session_id = b.session_id
and a.ex_timestamp  > b.ex_timestamp
and cast(substr(a.process_id,5,1) as int) -1  = cast(substr(b.process_id,5,1) as int)
)


,out2 as (
select *
from out 

union all

select a.*
from process_log as a
inner join out
on a.session_id = out.session_id
and cast(substr(a.process_id,5,1) as int) > cast(substr(out.process_id,5,1) as int)

union 
select a.*
from process_log as a
left outer join seiki
on a.session_id = seiki.session_id
and a.process_id = seiki.process_id
and a.user_id = seiki.user_id
and a.ex_timestamp = seiki.ex_timestamp
where cast(substr(a.process_id,5,1) as int) > 1
and seiki.process_id is null
)
---------------------------
select a.process_id
        ,count(a.process_id)

from process_log as a
left outer join out2
on a.session_id = out2.session_id
and a.process_id = out2.process_id
and a.user_id = out2.user_id
and a.ex_timestamp = out2.ex_timestamp

where out2.session_id is null

group by a.process_id











提出情報
提出日時2024/02/17 21:31:25
コンテスト第10回 SQLコンテスト
問題顧客行動分析
受験者asterect
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量86 MB
メッセージ
テストケース(通過数/総数)
0/4
状態
メモリ使用量
データパターン1
WA
85 MB
データパターン2
WA
84 MB
データパターン3
WA
86 MB
データパターン4
WA
85 MB