You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '102) group by ) as cp left join #__jbusinessdirec' at line 24 SQL=select slec.*, mainCategory, mainCategoryId, categoryMaker, companyName, companyId1, count( as nrRatings, features, GREATEST(if(FIND_IN_SET('featured_companies',features) ,1,0), featured) as featured from ( select cp.*, as companyName, as companyId1, as typeName, #cnt.contact_name, GROUP_CONCAT(DISTINCT pf.feature) as features, max(p.ordering) as packageOrder, as mainCategory, bc.alias as mainCategoryAlias ,bc.markerLocation as categoryMaker, as mainCategoryId from ( select,, cp2.alias, cp2.short_description, cp2.meta_description, cp2.street_number, cp2.address,, cp2.county,,,,, cp2.state, cp2.fax, cp2.averageRating, cp2.slogan,cp2.logoLocation, cp2.activity_radius, cp2. review_score, cp2.creationDate, cp2.featured,cp2.publish_only_city,cp2.userId, cp2.latitude, cp2.longitude, cp2.keywords,cp2.approved, cp2.mainSubcategory, cp2.countryId,cp2.typeId, cp2.postalCode, GROUP_CONCAT( DISTINCT,'|',,'|',cg.alias ORDER BY separator '#') as categories, GROUP_CONCAT( DISTINCT as categoryIds from #__jbusinessdirectory_companies cp2 left join #__jbusinessdirectory_company_category cc on left join #__jbusinessdirectory_categories cg on and cg.published=1 where 1 and cc.categoryId in (,102) group by ) as cp left join #__jbusinessdirectory_company_category cc on left join #__jbusinessdirectory_categories cg on and cg.published=1 left join #__jbusinessdirectory_categories bc on and bc.published=1 #left join #__jbusinessdirectory_company_contact cnt on left join #__jbusinessdirectory_company_types ct on left join #__jbusinessdirectory_orders inv on left join #__jbusinessdirectory_packages p on ( and p.status=1 and 0) or (p.price=0 and p.status=1 and 0) left join #__jbusinessdirectory_package_fields pf on left join #__jbusinessdirectory_company_attributes AS ca on where 1 and cc.categoryId in (,102) and cp.state=1 and (cp.approved = 2 or cp.approved= -1) group by order by ) as slec left join #__jbusinessdirectory_company_ratings cra on cra.companyId=companyId1 where 1 group by companyId1 having 1 order by featured desc, packageOrder desc LIMIT 0, 20

Go Back Home