ソースコード
select d.pf_code as 'CODE'
       , p.pf_name as 'NAME'
       , round(sum(d.amt + d2.amt) / sum(d.sum + d2.sum) * 100, 2) as 'PERCENTAGE'
from (select PF_CODE
             , amt 
             , sum(amt) as sum
       from  drink_habits 
       where gender_code = '2' 
       group by PF_CODE
             , amt) as d
inner join (select PF_CODE
             , amt
             , sum(amt) as sum
       from  drink_habits 
       where gender_code ='3'
       group by PF_CODE
             , amt) as d2
             on d2.pf_code = d.pf_code
inner join prefecture as p
on d.pf_code = p.pf_code
where 1 = 1 
group by d.pf_code
       , p.pf_name
order by PERCENTAGE desc, PF_NAME desc;
提出情報
提出日時2022/09/21 17:57:52
コンテスト第2回 SQLコンテスト
問題飲酒率
受験者roundoneknockout
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量95 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
95 MB
データパターン2
WA
88 MB