我有几张桌子。我只想写一个查询,它给了我没有下订单的日期。我正在使用左连接来获得 null 的结果,但问题是:使用它后我无法获得日期。
请帮助我,我的代码是这样的:
SELECT DAY(o.OrderDate) AS 'HavntRecivedOrder'
FROM Products p
INNER JOIN Suppliers sup ON p.SupplierID = sup.SupplierID
INNER JOIN OrderDetails od ON p.ProductID = od.ProductID
LEFT JOIN Orders o ON (od.OrderID = o.OrderID
AND o.OrderDate BETWEEN '1/1/1997' AND '1/31/1997')
WHERE sup.CompanyName='Tokyo Traders'
AND o.OrderDate IS NULL