ソースコード
SELECT A.CODE,A.NAME, (B.MAI / A.SOU)

FROM
(
SELECT 
 DH.PF_CODE AS CODE
,PR.PF_NAME AS NAME
,SUM(DH.AMT) AS SOU
FROM DRINK_HABITS AS DH
LEFT OUTER JOIN PREFECTURE AS PR
ON DH.PF_CODE = PR.PF_CODE

WHERE DH.GENDER_CODE IN ('2','3')
AND DH.CATEGORY_CODE = '110'
GROUP BY DH.PF_CODE,PR.PF_NAME
)A

LEFT OUTER JOIN 
(SELECT 
 DH.PF_CODE AS CODE
,PR.PF_NAME AS NAME
,SUM(DH.AMT) AS MAI

FROM DRINK_HABITS AS DH

LEFT OUTER JOIN PREFECTURE AS PR
ON DH.PF_CODE = PR.PF_CODE

WHERE DH.GENDER_CODE IN ('2','3')
AND DH.CATEGORY_CODE = '120'
GROUP BY DH.PF_CODE,PR.PF_NAME
)B

ON A.CODE = B.CODE

GROUP BY A.CODE,A.NAME
ORDER BY 3 DESC , 1 DESC
提出情報
提出日時2022/09/21 23:52:36
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者popopo1234
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量106 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
94 MB
データパターン2
WA
106 MB