SELECT SQL_CALC_FOUND_ROWS pOwn.* , (SELECT SUM(items_sold) FROM SC_products psort, SC_modifications_items misort WHERE psort.productID=misort.productID AND misort.Owner=pOwn.productID) as items_sold, name_ru AS _name_sort , `Price`>0 as `is_in_stock` FROM SC_products pOwn, SC_modifications_items mi WHERE pOwn.enabled=1 AND pOwn.productID=mi.Owner AND mi.productID IN (SELECT p.productID FROM SC_products p WHERE enabled=0 AND ( genderID="2" OR genderID="3") AND p.categoryID<>1 AND p.categoryID<>775 AND p.`hit`=1) GROUP BY mi.Owner ORDER BY items_sold DESC LIMIT 0,30