NOT IN vs NOT EXISTS
SELECT ProductID, ProductName FROM Northwind..Products pWHERE NOT EXISTS ( SELECT 1 FROM Northwind..[Order Details] od WHERE p.ProductId = od.ProductId)
Or NOT IN:
SELECT ProductID, ProductName FROM Northwind..Products pWHERE p.ProductID NOT IN ( SELECT ProductID FROM Northwind..[Order Details])
白衣染霜花
相关分类