ソースコード
WITH RecentCheckups AS (
    SELECT
        MEMBER_CODE,
        CHECKUP_DATE,
        WEIGHT,
        ROW_NUMBER() OVER (PARTITION BY MEMBER_CODE ORDER BY CHECKUP_DATE DESC) AS rn
    FROM
        HEALTH_CHECKUP
),
FilteredCheckups AS (
    SELECT
        c1.MEMBER_CODE,
        c1.CHECKUP_DATE AS CK_DATE,
        m.LAST_NAME || m.FIRST_NAME AS NAME,
        ROUND(c1.WEIGHT - c2.WEIGHT, 1) AS CHG_WT
    FROM
        RecentCheckups c1
        JOIN RecentCheckups c2 ON c1.MEMBER_CODE = c2.MEMBER_CODE AND c1.rn = 1 AND c2.rn = 2
        JOIN MEMBER_MST m ON c1.MEMBER_CODE = m.MEMBER_CODE
    WHERE
        ABS(c1.WEIGHT - c2.WEIGHT) >= 5
)
SELECT
    CK_DATE,
    MEMBER_CODE AS CODE,
    NAME,
    CASE
        WHEN CHG_WT = ROUND(CHG_WT, 0) THEN CAST(ROUND(CHG_WT, 0) AS INTEGER)
        ELSE CHG_WT
    END AS CHG_WT
FROM
    FilteredCheckups
ORDER BY
    CHG_WT DESC,
    MEMBER_CODE DESC;
提出情報
提出日時2024/06/30 16:04:59
コンテスト第13回 SQLコンテスト
問題体重差分
受験者yunyun8686
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
84 MB
データパターン2
WA
84 MB