ソースコード
with note as (select 
* from item
where not exists (select 1 from stock where stock.item_code = item.item_code)
)
, nl as (
select item_code from stock where last_delivery_date is null
)
, old as (
select 
item_code
, max(last_delivery_date) as ml
, sum(actual_amt) as aa
from stock
where item_code not in (select item_code from nl)
group by item_code
)
, dold as (
select item_code from old where ml <= date('2023-06-01', '-6 month') and aa = 0
)
delete from item where stock_management_type = 1 and (item_code in (select item_code from note) or item_code in (select item_code from dold));
提出情報
提出日時2024/05/05 14:26:25
コンテスト第7回 SQLコンテスト
問題商品整理
受験者daku10
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
84 MB
データパターン2
AC
83 MB