ソースコード
WITH TMP AS
(
    SELECT
         CLASS_CODE  AS CLASS_CODE
        ,CLASS_NAME  AS CLASS
        ,PERSON_CODE AS PERSON_CODE
        ,PERSON_NAME AS PERSON
        ,AMT         AS HOUSEHOLDS
    FROM HOUSEHOLD
    WHERE
         PERSON_CODE != '1'
     AND CLASS_CODE  != '01'
)
SELECT
     MAIN.CLASS
    ,MAIN.PERSON
    ,MAIN.HOUSEHOLDS
FROM TMP AS MAIN
     INNER JOIN (SELECT CLASS_CODE, MAX(HOUSEHOLDS) AS MAX_HOUSEHOLDS FROM TMP GROUP BY CLASS_CODE) AS MAX_VAL
     ON MAIN.CLASS_CODE = MAX_VAL.CLASS_CODE
    AND MAIN.HOUSEHOLDS = MAX_VAL.MAX_HOUSEHOLDS
ORDER BY MAIN.CLASS_CODE
;
提出情報
提出日時2022/10/19 17:36:12
コンテスト第3回 SQLコンテスト
問題最大世帯人員
受験者jalapeno
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量93 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
89 MB
データパターン2
AC
93 MB