ソースコード
select 
 case
  when e.ELEMENTARY >= 0 then sum(t1.ELEMENTARY) else 0 
  when e.MIDDLE >= 0 then sum(t1.MIDDLE) else 0 
 end as 'AMT'
from ENROLLMENT_STATUS e
join (
select 
 p.PF_CODE as PF_CODE
 , p.PF_NAME as PF_CODE
 , e.SURVEY_YEAR
 , ELEMENTARY as ELEMENTARY
 , case when MIDDLE IS NULL then 0 else MIDDLE end as MIDDLE
 , HIGH as HIGH
 , JUNIOR_CLG as JUNIOR_CLG
 , COLLEGE as COLLEGE
 , case when GRADUATE IS NULL then 0 else GRADUATE end as GRADUATE
from ENROLLMENT_STATUS e
join PREFECTURE p on p.PF_CODE = e.PF_CODE
where e.SURVEY_YEAR = 2020
) t1 on t1.PF_CODE = e.PF_CODE
join PREFECTURE p on p.PF_CODE = e.PF_CODE
where e.SURVEY_YEAR = 2020
-- group by ELEMENTARY, MIDDLE, HIGH, JUNIOR_CLG, COLLEGE, GRADUATE
提出情報
提出日時2022/09/26 14:37:10
コンテスト第2回 SQLコンテスト
問題就学状況の表示変換
受験者hachimaki37
状態 (詳細)RE
(Runtime Error: 実行時エラー)
メモリ使用量77 MB
メッセージ
SQLITE_ERROR: near "when": syntax error
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
RE
77 MB
データパターン2
RE
75 MB