Goalie3533
Programmer
I have a query that should diplay the 3 top selling items from a particular product category(i.e: Clothes, Hats, Shoes, etc). I'm joining 2 tables to gather all of the necessary information however more than 3 rows are being returned for some strange reason. I'm selecting the product ID #(catalogid), total quantity of the product sold(sum(oitems.numitems)) and joining those values with my Product Categories table(prodcategories) so I can match it up with one particular category(347). Any idea what's wrong with my query that would enable it to return more than 3 rows?
----------------------------------------------
select TOP 3 oitems.catalogid, sum(oitems.numitems) as sumofnumitems from oitems inner join prodcategories on oitems.catalogid=prodcategories.intcatalogid where prodcategories.intcategoryid=347 GROUP BY oitems.catalogid ORDER BY sum(oitems.numitems) DESC
------------------------------------------------
Thanks in advance.
-Goalie35
----------------------------------------------
select TOP 3 oitems.catalogid, sum(oitems.numitems) as sumofnumitems from oitems inner join prodcategories on oitems.catalogid=prodcategories.intcatalogid where prodcategories.intcategoryid=347 GROUP BY oitems.catalogid ORDER BY sum(oitems.numitems) DESC
------------------------------------------------
Thanks in advance.
-Goalie35