ソースコード
WITH SUB1 AS ( 
    SELECT
        HC1.CHECKUP_DATE
        , HC1.MEMBER_CODE
        , HC1.WEIGHT
        , LAG(HC1.WEIGHT, 1) OVER ( 
            PARTITION BY
                HC1.MEMBER_CODE 
            ORDER BY
                HC1.CHECKUP_DATE
        ) AS BEFORE_WT 
    FROM
        HEALTH_CHECKUP AS HC1
) 
SELECT
    SUB1.CHECKUP_DATE AS CK_DATE
    ,SUB1.MEMBER_CODE AS CODE
    ,MM.LAST_NAME||MM.FIRST_NAME AS NAME
    ,(SUB1.BEFORE_WT * 10 - SUB1.WEIGHT*10)/ 10 AS CHG_WT
    
FROM SUB1
    INNER JOIN MEMBER_MST MM
    ON SUB1.MEMBER_CODE = MM.MEMBER_CODE
    
WHERE SUB1.CHECKUP_DATE = (
    SELECT MAX(CHECKUP_DATE)
    FROM HEALTH_CHECKUP
    WHERE MEMBER_CODE = SUB1.MEMBER_CODE)
    AND ABS(SUB1.BEFORE_WT * 10 - SUB1.WEIGHT*10)/10 >= 5
    
ORDER BY
    CHG_WT DESC, CODE DESC
提出情報
提出日時2024/09/27 17:35:17
コンテスト第13回 SQLコンテスト
問題体重差分
受験者miroku
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
84 MB
データパターン2
WA
84 MB