ソースコード
with with_code as (
select distinct
    NTH_VALUE(CLASS_NAME , 1) OVER(PARTITION BY CLASS_CODE ORDER BY AMT DESC RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as CLASS
  , NTH_VALUE(CLASS_CODE , 1) OVER(PARTITION BY CLASS_CODE ORDER BY AMT DESC RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as CLASS_CODE
  , NTH_VALUE(PERSON_NAME, 1) OVER(PARTITION BY CLASS_CODE ORDER BY AMT DESC RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as PERSON
  , NTH_VALUE(AMT        , 1) OVER(PARTITION BY CLASS_CODE ORDER BY AMT DESC RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as HOUSEHOLDS
from
    HOUSEHOLD
where
    PERSON_CODE <> '1'
and CLASS_CODE  <> '01'
order by
   CLASS_CODE asc
)
select
    CLASS
  , PERSON
  , HOUSEHOLDS
from
    with_code
提出情報
提出日時2022/10/19 18:44:29
コンテスト第3回 SQLコンテスト
問題最大世帯人員
受験者kamaoda
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量96 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
96 MB
データパターン2
AC
92 MB