ソースコード
-- select
--   d.ITEM_CODE as CODE,
--   ifnull(i.ITEM_NAME, 'NULL') as NAME,
--   sum(d.ORDER_QTY) as SUM_QTY
-- from
--   ORDERS o
--   join WAREHOUSE w on o.WH_CODE = w.WH_CODE
--   join ORDERS_DTL d on o.ORDER_NO = d.ORDER_NO
--   left join ITEM i on i.ITEM_CODE = d.ITEM_CODE
-- where
--   w.WH_NAME = '浦和倉庫'
-- group by d.ITEM_CODE
-- having sum(d.ORDER_QTY) >= 50
-- order by
--   sum(d.ORDER_QTY) desc,
--   d.ITEM_CODE desc
  
select
  a.CODE as CODE,
  ifnull(i.ITEM_NAME, 'NULL') as NAME,
  SUM_QTY
from 
(
select
  d.ITEM_CODE as CODE,
  sum(d.ORDER_QTY) as SUM_QTY
from
  ORDERS o
  join WAREHOUSE w on o.WH_CODE = w.WH_CODE
  join ORDERS_DTL d on o.ORDER_NO = d.ORDER_NO
where
  w.WH_NAME = '浦和倉庫'
group by d.ITEM_CODE
having sum(d.ORDER_QTY) >= 50
) a
left join ITEM i on i.ITEM_CODE = a.CODE
order by
  a.SUM_QTY desc,
  a.CODE desc
提出情報
提出日時2024/06/09 15:00:23
コンテスト第1回 SQLコンテスト初級編
問題売れ筋商品
受験者ysk1180
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量95 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
95 MB
データパターン2
WA
84 MB