ソースコード
select 
a.PORT_CODE as 港コード,
a.PORT_NAME as 港名,
sum(case when b.KIND_CODE = '110' then b.AMT end) as 入国者数,
sum(case when b.KIND_CODE = '120' then b.AMT end) as 出国者数,
sum(case when b.KIND_CODE = '110' then b.AMT end) -
sum(case when b.KIND_CODE = '120' then b.AMT end) as 差分
from  IMMIGRATION b
inner join  PORT a on a.PORT_CODE = b.PORT_CODE
inner join  GRP c on b.GROUP_CODE = c.GROUP_CODE
where b.KIND_CODE = '110'or b.KIND_CODE = '120'
group by b.PORT_CODE
having (sum(case when b.KIND_CODE = '110' then b.AMT end) -
sum(case when b.KIND_CODE = '120' then b.AMT end)) > 0
order by (sum(case when b.KIND_CODE = '110' then b.AMT end) -
sum(case when b.KIND_CODE = '120' then b.AMT end)) DESC,
a.PORT_CODE DESC
提出情報
提出日時2022/07/20 18:48:24
コンテスト第1回 SQLコンテスト
問題港入出国者分析
受験者y_n
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量105 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
WA
100 MB
データパターン2
AC
105 MB