ソースコード
with ne as (
select ITEM.ITEM_CODE
from ITEM left join STOCK on ITEM.ITEM_CODE = STOCK.ITEM_CODE
where STOCK.ITEM_CODE is null and ITEM.STOCK_MANAGEMENT_TYPE = 1
)
, old as (
select STOCK.ITEM_CODE
, MAX(LAST_DELIVERY_DATE) as ML
, SUM(ACTUAL_AMT) as SA
from STOCK join ITEM on STOCK.ITEM_CODE = ITEM.ITEM_CODE
where ITEM.STOCK_MANAGEMENT_TYPE = 1
group by STOCK.ITEM_CODE
)
, old2 as (
select ITEM_CODE from old
where SA = 0 and ML < '2022-12-01'
)
delete from item where ITEM_CODE IN (select ITEM_CODE from ne union all select ITEM_CODE from old2)
;
提出情報
提出日時2024/04/27 03:01:03
コンテスト第7回 SQLコンテスト
問題商品整理
受験者daku10
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
84 MB
データパターン2
WA
84 MB