I have two tables that are grouped by OrderID
.
Something like:
Orders.OrderID
OrderDetails.OrderID
I'm trying to call a column from the OrderDetails
table, but I need it in the Orders
table.
I need to call a JOIN
or INNER JOIN
or GROUP BY
where I can group the OrderDetails
with the Orders
table and where the OrderID
's match display the OrderDetails.ProductCode
. Since that barely makes sense, here is my current query:
SELECT
Orders.OrderID, Orders.OrderDate, Orders.ShipLastName, Orders.ShipFirstName,
Orders.ShipCity, Orders.ShipState, Orders.Order_Comments, Orders.OrderNotes,
Orders.ShipPhoneNumber, Orders.ShipDate
FROM Orders
WHERE Orders.OrderStatus = 'Shipped'
AND Orders.ShipDate > DATEADD(Day, Datediff(Day,0, GetDate() -20), 0)
AND Orders.ShipDate < DATEADD(Day, Datediff(Day,0, GetDate() -13), 0)
Basically I'd like to SELECT
OrderDetails.ProductCode but first need to group them by OrderID
since they're on different tables.
Thanks