The following query gives me the exact information I need but it takes about 10 minutes for it to run. Is there anyway to speed this query up?
SELECT Auctions.CurrentPrice, Items.PartNum, Items.ShortDescription, Max(DateValue([Auctions.EndDate])) AS [Closing Date]
FROM (Sales INNER JOIN Items ON Sales.ItemID = Items.ItemID) INNER JOIN Auctions ON (Sales.SaleID = Auctions.SaleID) AND (Items.ItemID = Auctions.ItemID)
WHERE (((Sales.DatePaymentReceived) Is Null) AND ((Sales.DatePaymentCleared) Is Null) AND ((Sales.StatusID)<200) AND ((Date()-[Auctions.EndDate])>17) AND ((Items.PartNum) Not In
(SELECT Items.PartNum
FROM (Items INNER JOIN Auctions ON Items.ItemID = Auctions.ItemID) INNER JOIN Sales ON (Items.ItemID = Sales.ItemID) AND (Auctions.SaleID = Sales.SaleID)
WHERE (((Auctions.StatusID)=80) AND ((Sales.DatePaymentReceived) Is Not Null) AND ((Sales.DatePaymentCleared) Is Not Null)))))
GROUP BY Auctions.CurrentPrice, Items.PartNum, Items.ShortDescription
ORDER BY Max(DateValue([Auctions.EndDate])) DESC
Please note that the extra spacing is for ease of readability (I hope
SELECT Auctions.CurrentPrice, Items.PartNum, Items.ShortDescription, Max(DateValue([Auctions.EndDate])) AS [Closing Date]
FROM (Sales INNER JOIN Items ON Sales.ItemID = Items.ItemID) INNER JOIN Auctions ON (Sales.SaleID = Auctions.SaleID) AND (Items.ItemID = Auctions.ItemID)
WHERE (((Sales.DatePaymentReceived) Is Null) AND ((Sales.DatePaymentCleared) Is Null) AND ((Sales.StatusID)<200) AND ((Date()-[Auctions.EndDate])>17) AND ((Items.PartNum) Not In
(SELECT Items.PartNum
FROM (Items INNER JOIN Auctions ON Items.ItemID = Auctions.ItemID) INNER JOIN Sales ON (Items.ItemID = Sales.ItemID) AND (Auctions.SaleID = Sales.SaleID)
WHERE (((Auctions.StatusID)=80) AND ((Sales.DatePaymentReceived) Is Not Null) AND ((Sales.DatePaymentCleared) Is Not Null)))))
GROUP BY Auctions.CurrentPrice, Items.PartNum, Items.ShortDescription
ORDER BY Max(DateValue([Auctions.EndDate])) DESC
Please note that the extra spacing is for ease of readability (I hope