ソースコード
DELETE FROM ITEM WHERE ITEM_CODE IN (
SELECT ITEM.ITEM_CODE
FROM ITEM LEFT OUTER JOIN STOCK ON STOCK.ITEM_CODE = ITEM.ITEM_CODE
WHERE STOCK.STOCK_TYPE IS NULL
AND STOCK_MANAGEMENT_TYPE = 1
UNION
SELECT ITEM.ITEM_CODE
FROM ITEM LEFT OUTER JOIN STOCK ON STOCK.ITEM_CODE = ITEM.ITEM_CODE
WHERE STOCK.STOCK_TYPE IS NOT NULL
AND STOCK_MANAGEMENT_TYPE = 1
GROUP BY STOCK.ITEM_CODE
HAVING SUM(STOCK.ACTUAL_AMT) = 0
AND MAX(STOCK.LAST_DELIVERY_DATE) NOT BETWEEN '2022-12-31' AND '2023-06-01'
UNION
SELECT ITEM.ITEM_CODE
FROM ITEM LEFT OUTER JOIN STOCK ON STOCK.ITEM_CODE = ITEM.ITEM_CODE
WHERE STOCK.STOCK_TYPE IS NOT NULL
AND STOCK_MANAGEMENT_TYPE = 1
GROUP BY STOCK.ITEM_CODE
HAVING STOCK.LAST_DELIVERY_DATE IS NULL
)
提出情報
提出日時2023/06/18 10:26:15
コンテスト第7回 SQLコンテスト
問題商品整理
受験者y.k.
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量86 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
78 MB
データパターン2
WA
86 MB