ソースコード
SELECT
    SUB1.CHECKUP_DATE AS CK_DATE
    , SUB1.MEMBER_CODE AS CODE
    , LAST_NAME || FIRST_NAME AS NAME
    , (SUB1.WEIGHT * 10 - SUB1.BEFORE_WT * 10) / 10 AS CHG_WT 
FROM
 (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
 ) SUB1
INNER JOIN MEMBER_MST AS MM 
 ON MM.MEMBER_CODE = SUB1.MEMBER_CODE 
WHERE
 SUB1.CHECKUP_DATE = (SELECT MAX(CHECKUP_DATE) FROM HEALTH_CHECKUP WHERE MEMBER_CODE = SUB1.MEMBER_CODE) 
 AND ABS((SUB1.WEIGHT * 10 - SUB1.BEFORE_WT * 10) / 10) >= 5 
ORDER BY CHG_WT DESC, CODE DESC
 
提出情報
提出日時2024/11/01 15:00:53
コンテスト第13回 SQLコンテスト
問題体重差分
受験者nmanh
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
84 MB
データパターン2
AC
84 MB