SELECT categoryname, c.categoryid, categorydescription, c.parentid, childlevel, isNull(plist.cntofchildren, 0) 'countofchildren', showanonymous, isNull(cnt, 0) AS countofproducts FROM (select * from tblprodcategories where isNull(fk_storeid, 0) in(0, 112)) c LEFT JOIN (SELECT categoryid, count(*) AS cnt FROM tblcategoryproductbridge WHERE productid in(SELECT productid FROM tblproducts WHERE discontinued = 0) group by categoryid ) cn ON c.categoryid = cn.categoryid LEFT JOIN (SELECT parentid , count(*) cntofchildren FROM (select * from tblprodcategories where isNull(fk_storeid, 0) in(0, 112)) ccount group by parentid) plist ON c.categoryid = plist.parentid WHERE c.CategoryID IN( SELECT CategoryID FROM ut_GroupCategoryPermissions WHERE GroupID IN( SELECT GroupID FROM ut_UserGroupMemberShip WHERE UserID=0 ) UNION SELECT CategoryID FROM tblCategorySecurity WHERE UserID= 0 ) OR (0 = 0 AND showanonymous = 1) order by childlevel asc, isNull(sortorder, 100000), categoryname

 


 
  Flex Flow Finishing Hairspray 10.2 oz

   
 
  Bold Hold Hairspray 10.2 oz

   
 
  Lock Launder Strengthening Dry Shampoo 3.5 oz

   
 
  Glowtion Potion Styling Oil 3 oz

   
 
  Root Lift Spray Gel 8 oz

   
 
  Lock Luster Nourishing Spray Conditioner 3.5 oz

   
 
  Sparkle and Shine Copper

   
 
  Sparkle and Shine Bronze

   
 
  Vita Volume Boosting Foam 8.5 oz

   
 
  Sparkle and Shine Gold