SQL Help

houssam_ballout

New Member
Hello all,
There is an error in the following sql, it is returning the same field of the order,
any help


SELECT order.OrderID, order.Total, order.count, orderedItems.OrderID, orderedItems.ItemID, orderedItems.amount
FROM orderedItems INNER JOIN [order] ON orderedItems.OrderID = order.OrderID;

\thanks
 
It's doing what now?

I don't think it matters but the only thing I see is the [ ] around order for your join. Also, why are you getting OrderID twice? You already have it from the order table.
 
well , I have fixed the first problem by including [] around the order, I dont know why? But the error is that it is only giving me the first row of the table
 
Sounds like your join field isn't matching then. Do you know that the orderID are duplicated in both tables?

You could always try removing the join and going with something like:
SELECT order.OrderID, order.Total, order.count, orderedItems.OrderID, orderedItems.ItemID, orderedItems.amount FROM orderedItems WHERE orderedItems.OrderID = order.OrderID;
 
Back
Top