The following query is to retrieve the sum of a table of orders per category.
The orderline table has the fields productnumber and numordered (which is the number of the same product ordered).
The product table has the fields productnumber, category and salesprice.
The query seems to work properly, but doesn't take numordered into account.
I was thinking that maybe I could replicate the results to the number of numordered in the subquery.Code:SELECT `product`.`category` , sum( `product`.`salesprice` ) AS 'total' FROM `product` WHERE `product`.`productnumber` IN ( SELECT `orderline`.`productnumber` FROM `orderline` ) GROUP BY `product`.`category`
Is that possible?
Or any other suggestions?
I can post the database if you need it.
Thanks![]()




Reply With Quote