The query I'm trying to do is query that taking from OrderDetails all the items that accounts bought sum them for one row and show for me how much bought from any product, what i am tring to do it is to show the itemname and the item Image not only the id and sum this is the query that i did:
string strSql = "SELECT Sum(OrderDetails.ItemStock),OrderDetails.ItemID,Items.ItemName,Items.ItemImage FROM OrderDetails,Items WHERE OrderDetails.ItemID = Items.ItemID GROUP BY OrderDetails.ItemID ORDER BY SUM(OrderDetails.ItemStock) DESC";
the error that i got from this query : "The query does not include the specified phrase 'ItemName' as part of an aggregate function."
when i'm writing the query like this :
string strSql = "SELECT Sum(OrderDetails.ItemStock),OrderDetails.ItemID FROM OrderDetails GROUP BY OrderDetails.ItemID ORDER BY SUM(OrderDetails.ItemStock) DESC";
it is ok