ソースコード
WITH
    H2 AS (
        SELECT
            CLASS_NAME AS CLASS,
            PERSON_NAME AS PERSON,
            SUM(AMT) AS HOUSEHOLDS
        FROM
            HOUSEHOLD
        WHERE
            CLASS_CODE <> '01'
            AND PERSON_CODE <> '1'
        GROUP BY
            CLASS_NAME,
            PERSON_NAME
    ),
    MaxHouseholds AS (
        SELECT
            CLASS,
            MAX(HOUSEHOLDS) AS MaxHouseholds
        FROM
            H2
        GROUP BY
            CLASS
    )
SELECT
    H2.CLASS,
    H2.PERSON,
    H2.HOUSEHOLDS
FROM
    H2
    JOIN MaxHouseholds mh ON H2.CLASS = mh.CLASS
    AND H2.HOUSEHOLDS = mh.MaxHouseholds;
提出情報
提出日時2024/07/13 10:23:21
コンテスト第3回 SQLコンテスト
問題最大世帯人員
受験者hassy
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
85 MB
データパターン2
AC
83 MB