DELETE .ebaySellingListSKU
OUTPUT DELETED.*
FROM( SELECT k.* FROM .ebaySellingListSKU K
JOIN .ebaySellingListSKUDel S ON S.ItemID=K.ItemID) A
LEFT JOIN .ebaySellingListSKUDel D ON A.ItemID=D.ItemID AND A.SKU=D.SKU
WHERE D.SKU IS NULL
根据筛选是只有3条数据的 删除了全部数据
DELETE K
OUTPUT DELETED.*
FROM ebaySellingListSKU K
JOIN ebaySellingListSKUDel S ON K.ItemID = S.ItemID
LEFT JOIN ebaySellingListSKUDel D ON K.ItemID = D.ItemID AND K.SKU = D.SKU
WHERE D.SKU IS NULL
應該要這樣寫
你原本的寫法,條件完全沒有下到你要刪除的表上,當然會變成全部刪除
嗯嗯 自己写晕了 三克油