ソースコード
select
 B.AGE_NAME
,A.'5時間未満'
,A.'5時間以上6時間未満'
,A.'6時間以上7時間未満'
,A.'7時間以上8時間未満'
,A.'8時間以上9時間未満'
,A.'9時間以上'
,A.'不詳'
from
(
select
 a.AGE_CODE
,a.TARGET_POP as '5時間未満'
,b.TARGET_POP as '5時間以上6時間未満'
,c.TARGET_POP as '6時間以上7時間未満'
,d.TARGET_POP as '7時間以上8時間未満'
,e.TARGET_POP as '8時間以上9時間未満'
,f.TARGET_POP as '9時間以上'
,g.TARGET_POP as '不詳'
from
(select
 AGE_CODE
,sum(TARGET_POP) as TARGET_POP
from SLEEP_TIME_DTL
where TIME_CODE = 120
group by AGE_CODE) as a
left join 
(select
 AGE_CODE
,sum(TARGET_POP) as TARGET_POP
from SLEEP_TIME_DTL
where TIME_CODE = 130
group by AGE_CODE) as b
on a.AGE_CODE = b.AGE_CODE
left join 
(select
 AGE_CODE
,sum(TARGET_POP) as TARGET_POP
from SLEEP_TIME_DTL
where TIME_CODE = 140
group by AGE_CODE) as c
on a.AGE_CODE = c.AGE_CODE
left join 
(select
 AGE_CODE
,sum(TARGET_POP) as TARGET_POP
from SLEEP_TIME_DTL
where TIME_CODE = 150
group by AGE_CODE) as d
on a.AGE_CODE = d.AGE_CODE
left join 
(select
 AGE_CODE
,sum(TARGET_POP) as TARGET_POP
from SLEEP_TIME_DTL
where TIME_CODE = 160
group by AGE_CODE) as e
on a.AGE_CODE = e.AGE_CODE
left join 
(select
 AGE_CODE
,sum(TARGET_POP) as TARGET_POP
from SLEEP_TIME_DTL
where TIME_CODE = 170
group by AGE_CODE) as f
on a.AGE_CODE = f.AGE_CODE
left join 
(select
 AGE_CODE
,sum(TARGET_POP) as TARGET_POP
from SLEEP_TIME_DTL
where TIME_CODE = 180
group by AGE_CODE) as g
on a.AGE_CODE = g.AGE_CODE
) A
left join AGE_GRP B
on A.AGE_CODE = B.AGE_CODE
order by A.AGE_CODE asc
提出情報
提出日時2022/07/13 15:56:22
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者abc
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量82 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
82 MB
データパターン2
WA
80 MB