ソースコード
DELETE FROM ITEM
WHERE 
(
    ITEM_CODE IN (
        SELECT distinct(i.ITEM_CODE)
        FROM ITEM as i
            LEFT OUTER JOIN STOCK as s
            on i.ITEM_CODE = s.ITEM_CODE
        where s.ITEM_CODE is null 
    )
or
    ITEM_CODE IN (
        SELECT i.ITEM_CODE
        FROM ITEM as i
            INNER JOIN STOCK as s
            on i.ITEM_CODE = s.ITEM_CODE
        where 
            LAST_DELIVERY_DATE <= '2022-12-01'
        group by i.ITEM_CODE
        having ACTUAL_AMT = 0
    )
)
and STOCK_MANAGEMENT_TYPE = '1'
;
-- SELECT * FROM ITEM;

-- SELECT i.ITEM_CODE
-- FROM ITEM as i
--   INNER JOIN STOCK as s
--   on i.ITEM_CODE = s.ITEM_CODE
-- where 
--   LAST_DELIVERY_DATE <= '2022-12-01'
-- group by i.ITEM_CODE
-- having ACTUAL_AMT = 0

-- union  
-- SELECT distinct(i.ITEM_CODE)
-- FROM ITEM as i
--   INNER JOIN STOCK as s
-- on i.ITEM_CODE = s.ITEM_CODE;
提出情報
提出日時2023/06/19 00:31:30
コンテスト第7回 SQLコンテスト
問題商品整理
受験者Hodgepodge
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
84 MB
データパターン2
WA
80 MB