ソースコード
with temp as (
    select member_code,
    checkup_date,
    row_number() over (partition by member_code order by checkup_date desc) as rank,
    weight
    from health_checkup
)

select temp.checkup_date as CK_DATE,
MEMBER_MST.MEMBER_CODE as CODE,
MEMBER_MST.LAST_NAME || '' || MEMBER_MST.FIRST_NAME as NAME,
round(temp.weight - temp2.weight, 1) as CHG_WT
from temp
inner join temp as temp2 
on temp.member_code = temp2.member_code
and temp.rank = 1
and temp2.rank = 2
inner join MEMBER_MST
on MEMBER_MST.MEMBER_CODE = temp.member_code
where abs(CHG_WT) >= 5
order by CHG_WT desc, MEMBER_MST.MEMBER_CODE desc;

提出情報
提出日時2024/06/24 00:37:07
コンテスト第13回 SQLコンテスト
問題体重差分
受験者hatarino
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量91 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
85 MB
データパターン2
AC
91 MB