select products.*, companies.*, locations.location from products, companies, locations where products.compid = companies.compid and products.origincountryid = locations.countryid and locations.zoneid = 99 and products.imgfilenr > 0 and products.offline = 0 and companies.totalpayments > 0 and ((match(productname) against ('+17-4ph +xm +-19' IN BOOLEAN MODE))) group by companies.compid order by companies.rating desc, products.promotionid desc limit 0, 5