I keep on having an error
Incorrect Syntax near keyword ‘SELECT’
Incorrect syntac near ‘)’
(SELECT TOP 5 t2.ItemID, SUM(t2.Quantity)
FROM Orders as t1
as Quantity FROM t2.ItemID in
(SELECT ItemID FROM Orders as t1 INNER JOIN BasketItems as t2 on t2.BasketID = t1.BasketID
WHERE t1.OrderStatusID = 3 AND t1.OrderDate BETWEEN '" + LastWeekDate + "' AND '" + TomorrowsdaysDate + "')
GROUP BY t2.ItemID ORDER BY Quantity desc");
you’re missing the FROM section in the outer SELECT statement (line 2)
What you have in there is a WHERE condition
Also i dont think you need a sub query for this
try this