ソースコード
WITH HEIGHT_AVG AS(
    SELECT
        AGE,
        GENDER_CODE,
        AVG(AVERAGE_VALUE) AS 'HAVG'
    FROM
        SCHOOL_HEALTH
    WHERE
        SURVEY_YEAR=2019
        AND CATEGORY_CODE='10'
    GROUP BY
        AGE, GENDER_CODE
), WEIGHT_AVG AS(
    SELECT
        AGE,
        GENDER_CODE,
        AVG(AVERAGE_VALUE) AS 'WAVG'
    FROM
        SCHOOL_HEALTH
    WHERE
        SURVEY_YEAR=2019
        AND CATEGORY_CODE='20'
    GROUP BY
        AGE, GENDER_CODE
)

SELECT
    AGE AS 'AGE',
    GENDER_CODE AS 'GENDER',
    HAVG AS 'H_AVG'
FROM
    SCHOOL_HEALTH AS SH
    INNER JOIN HEIGHT_AVG AS HA ON SH.AGE=HA.AGE AND SH.GENDER=HA.GENDER_CODE
WHERE
    SURVEY_YEAR=2019
GROUP BY
    AGE, GENDER
    
提出情報
提出日時2023/10/25 16:17:06
コンテスト第8回 SQLコンテスト
問題身長と体重
受験者honyara
状態 (詳細)RE
(Runtime Error: 実行時エラー)
メモリ使用量78 MB
メッセージ
SQLITE_ERROR: ambiguous column name: AGE
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
RE
75 MB
データパターン2
RE
78 MB