ソースコード
with health_checkup_rnk as (
    select
        checkup_date,
        member_code,
        weight,
        rank()over(partition by member_code order by checkup_date desc) as rnk
    from
        health_checkup
)
select 
    hc1.checkup_date as CK_DATE,
    m.member_code as CODE,
    m.last_name || m.first_name as NAME,
    round(hc1.weight - hc2.weight, 1) as CHG_WT
from 
    member_mst m
left join 
    health_checkup_rnk as hc1
    on m.member_code = hc1.member_code 
    and hc1.rnk = 1
left join 
    health_checkup_rnk as hc2
    on m.member_code = hc2.member_code 
    and hc2.rnk = 2
where 
    abs(hc1.weight - hc2.weight) >= 5
order by 
    hc1.weight - hc2.weight desc,
    m.member_code asc 
提出情報
提出日時2024/09/08 14:27:23
コンテスト第13回 SQLコンテスト
問題体重差分
受験者TKita
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量90 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
90 MB
データパターン2
WA
85 MB