コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
SELECT
AG.AGE_NAME AS '年齢階層',
TB1.TOTAL AS '5時間未満',
TB2.TOTAL AS '5時間以上6時間未満',
TB3.TOTAL AS '6時間以上7時間未満',
TB4.TOTAL AS '7時間以上8時間未満',
TB5.TOTAL AS '8時間以上9時間未満',
TB6.TOTAL AS '9時間以上',
TB7.TOTAL AS '不詳'
FROM
SLEEP_TIME_DTL SL
INNER JOIN AGE_GRP AG ON SL.AGE_CODE = AG.AGE_CODE
INNER JOIN SLEEP_TIME ST ON SL.TIME_CODE = ST.TIME_CODE
LEFT JOIN
(
SELECT
t1.AGE_CODE,
SUM(t1.TARGET_POP) AS TOTAL
FROM
SLEEP_TIME_DTL t1
WHERE
TIME_CODE = 120
GROUP BY
t1.AGE_CODE
) TB1 ON SL.AGE_CODE = TB1.AGE_CODE
LEFT JOIN
(
SELECT
t2.AGE_CODE,
SUM(t2.TARGET_POP) AS TOTAL
FROM
SLEEP_TIME_DTL t2
WHERE
TIME_CODE = 130
GROUP BY
t2.AGE_CODE
) TB2 ON SL.AGE_CODE = TB2.AGE_CODE
LEFT JOIN
(
SELECT
t3.AGE_CODE,
SUM(t3.TARGET_POP) AS TOTAL
FROM
SLEEP_TIME_DTL t3
WHERE
TIME_CODE = 140
GROUP BY
t3.AGE_CODE
) TB3 ON SL.AGE_CODE = TB3.AGE_CODE
LEFT JOIN
(
SELECT
t4.AGE_CODE,
SUM(t4.TARGET_POP) AS TOTAL
FROM
SLEEP_TIME_DTL t4
WHERE
TIME_CODE = 150
GROUP BY
t4.AGE_CODE
) TB4 ON SL.AGE_CODE = TB4.AGE_CODE
LEFT JOIN
(
SELECT
t5.AGE_CODE,
SUM(t5.TARGET_POP) AS TOTAL
FROM
SLEEP_TIME_DTL t5
WHERE
TIME_CODE = 160
GROUP BY
t5.AGE_CODE
) TB5 ON SL.AGE_CODE = TB5.AGE_CODE
LEFT JOIN
(
SELECT
t6.AGE_CODE,
SUM(t6.TARGET_POP) AS TOTAL
FROM
SLEEP_TIME_DTL t6
WHERE
TIME_CODE = 170
GROUP BY
t6.AGE_CODE
) TB6 ON SL.AGE_CODE = TB6.AGE_CODE
LEFT JOIN
(
SELECT
t7.AGE_CODE,
SUM(t7.TARGET_POP) AS TOTAL
FROM
SLEEP_TIME_DTL t7
WHERE
TIME_CODE = 180
GROUP BY
t7.AGE_CODE
) TB7 ON SL.AGE_CODE = TB7.AGE_CODE
GROUP BY
SL.AGE_CODE
ORDER BY
SL.AGE_CODE ASC
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
85 MB
データパターン2
AC
84 MB