ソースコード
-- with t as (
--     select CLASS_NAME as "CLASS",PERSON_NAME as "PERSON",sum(amt) as "HOUSEHOLDS", class_code, rank() over()
--     from HOUSEHOLD as h
--     where h.CLASS_CODE!='01' and PERSON_CODE!='1'
--     group by 1,2
-- )
-- select CLASS,PERSON, HOUSEHOLDS
with t as (
    select CLASS_NAME as "CLASS", 
    PERSON_NAME as "PERSON",class_code, rank() over(partition by class_name order by amt desc) as r, amt
    from HOUSEHOLD as h
    where h.CLASS_CODE!='01' and PERSON_CODE!='1'
)
select class as "CLASS",
max(case when r=1 then person end) as "PERSON",
max(case when r=1 then amt end) as "HOUSEHOLD"
from t
group by 1
order by class_code
提出情報
提出日時2023/04/15 17:23:37
コンテスト第3回 SQLコンテスト
問題最大世帯人員
受験者tabr
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量94 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
94 MB
データパターン2
WA
84 MB