Query SELECT count(distinct a.mrepc_no) as total, a.igcat_id, b.category as product_name, c.rubber_name, c.rubber_type FROM company_product_exp_upd a, igroup_cat_upd b, rubber_type c, company_details d, company_product e, igcat_item_upd f WHERE a.mrepc_no = d.mrepc_no and d.mrepc_no = e.mrepc_no AND (d.not_active IS NULL OR d.not_active = 0) AND a.product_name LIKE '%Seals,Gaskets,Washers%' AND a.igcat_id = b.cat_id AND b.rubber_type = c.rubber_type group by a.igcat_id order by b.category failed