I've gone over this code several times but I cannot figure out why I'm getting
Incorrect Syntax near the keyword 'SR'
Here's my SELECT query:
SELECT OrderDetails.OrderID,OrderDetails.ProductCode,OrderDetails.Vendor_Price,OrderDetails.Quantity
FROM OrderDetails
JOIN
(SELECT OrderDetails.OrderID,
CASE Orders.SalesRep_CustomerID WHEN 1 THEN 'S' WHEN 2 THEN 'K' WHEN 3 THEN 'M' ELSE '' END
FROM Orders
GROUP BY OrderDetails.OrderID)
AS 'SR'
WHERE OrderDetails.ShipDate IS NOT NULL
AND OrderDetails.ShipDate >= DATEADD(Day, Datediff(Day,0, GetDate() -6), 0)
ORDER BY OrderDetails.ProductCode ASC
It's pretty straightforward I just don't see the syntax error the computer is referring to. Thanks.
'SR'JOIN <table> ON <columnA> = <columnB>, and you're missing theONand columns to JOIN.