ソースコード
SELECT
AGE_NAME AS 年齢階層,
COALESCE(A.X, 0) AS '5時間未満',
COALESCE(B.X, 0) AS '5時間以上6時間未満',
COALESCE(C.X, 0) AS '6時間以上7時間未満',
COALESCE(D.X, 0) AS '7時間以上8時間未満',
COALESCE(E.X, 0) AS '8時間以上9時間未満',
COALESCE(F.X, 0) AS '9時間以上',
COALESCE(G.X, 0) AS '不詳'
FROM AGE_GRP
LEFT JOIN (SELECT SUM(TARGET_POP) AS X, AGE_CODE FROM SLEEP_TIME_DTL
    WHERE TIME_CODE=120 GROUP BY AGE_CODE) AS A USING(AGE_CODE)
LEFT JOIN (SELECT SUM(TARGET_POP) AS X, AGE_CODE FROM SLEEP_TIME_DTL
    WHERE TIME_CODE=130 GROUP BY AGE_CODE) AS B USING(AGE_CODE)
LEFT JOIN (SELECT SUM(TARGET_POP) AS X, AGE_CODE FROM SLEEP_TIME_DTL
    WHERE TIME_CODE=140 GROUP BY AGE_CODE) AS C USING(AGE_CODE)
LEFT JOIN (SELECT SUM(TARGET_POP) AS X, AGE_CODE FROM SLEEP_TIME_DTL
    WHERE TIME_CODE=150 GROUP BY AGE_CODE) AS D USING(AGE_CODE)
LEFT JOIN (SELECT SUM(TARGET_POP) AS X, AGE_CODE FROM SLEEP_TIME_DTL
    WHERE TIME_CODE=160 GROUP BY AGE_CODE) AS E USING(AGE_CODE)
LEFT JOIN (SELECT SUM(TARGET_POP) AS X, AGE_CODE FROM SLEEP_TIME_DTL
    WHERE TIME_CODE=170 GROUP BY AGE_CODE) AS F USING(AGE_CODE)
LEFT JOIN (SELECT SUM(TARGET_POP) AS X, AGE_CODE FROM SLEEP_TIME_DTL
    WHERE TIME_CODE=180 GROUP BY AGE_CODE) AS G USING(AGE_CODE)
ORDER BY AGE_CODE ASC
提出情報
提出日時2022/07/04 17:57:24
コンテスト練習用コンテスト
問題年齢別睡眠時間分析
受験者paruki
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量81 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
80 MB
データパターン2
WA
81 MB