ソースコード
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:01:44
コンテスト第7回 SQLコンテスト
問題商品整理
受験者ryo_tokyo
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量76 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
75 MB
データパターン2
WA
76 MB