ソースコード
delete from ITEM as t1
where exists(
    select * from ITEM as t2
    left join STOCK on t2.ITEM_CODE = STOCK.ITEM_CODE
    where STOCK.ITEM_CODE is null
    and t2.STOCK_MANAGEMENT_TYPE = 1
    and t1.ITEM_CODE = t2.ITEM_CODE
    group by STOCK.ITEM_CODE 
);

delete from ITEM as t1
where exists(
    select * from ITEM as t2
    inner join STOCK on t2.ITEM_CODE = STOCK.ITEM_CODE
    where t2.STOCK_MANAGEMENT_TYPE = 1
    and t1.ITEM_CODE = t2.ITEM_CODE
    group by t2.ITEM_CODE
    having max(LAST_DELIVERY_DATE)<=datetime('2023-06-01', '-6 months') and sum(ACTUAL_AMT) = 0 
);
提出情報
提出日時2023/08/04 21:02:46
コンテスト第7回 SQLコンテスト
問題商品整理
受験者ryo_tokyo
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量77 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
77 MB
データパターン2
AC
77 MB