Sums and Joins not correct
I have two tables, one with a list of products, and one a checkout table.
I've written this query:
SELECT tblComponents.Name, tblComponents.Tax,
SUM(CONVERT(int,ProductCheckout.ItemQuantity)) as Quantity
FROM tblComponents
INNER JOIN ProductCheckout
ON tblComponents.ID=ProductCheckout.ItemID where tblComponents.Tax <> 0
Group BY tblComponents.Name, ProductCheckout.ItemQuantity, tblComponents.Tax;
I'm looking to get the total number/quantity of items ordered.
Currently it shows
OrderName 2.00 1
OrderName 2.00 2
I want it to show:
OrderName 4 3
I'm looking to get a list of all the product names, with the sum of the
taxes and quantity ordered.
I'm not sure what is wrong with this query, but I need to be pointed in
the right direction.
No comments:
Post a Comment