You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1266) group by cp2.id ) as cp left join oq2js_jbusinessdir' at line 25 SQL=select slec.*, mainCategory, mainCategoryId, categoryMaker, companyName, companyId1, count(cra.id) as nrRatings, features, GREATEST(if(FIND_IN_SET('featured_companies',features) ,1,0), featured) as featured from ( select cp.*, cp.name as companyName,cp.id as companyId1, ct.name as typeName, #cnt.contact_name, GROUP_CONCAT(DISTINCT pf.feature) as features, max(p.ordering) as packageOrder, bc.name as mainCategory, bc.alias as mainCategoryAlias ,bc.markerLocation as categoryMaker, bc.id as mainCategoryId from ( select cp2.id, cp2.name, cp2.alias, cp2.short_description, cp2.street_number, cp2.address, cp2.city, cp2.county, cp2.website, cp2.phone, cp2.email, cp2.state, cp2.fax, cp2.averageRating, cp2.slogan,cp2.logoLocation, cp2.activity_radius, cp2. review_score, 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.id) as categoryIds, GROUP_CONCAT(cg.name separator '#') as categoryNames, GROUP_CONCAT(cg.alias separator '#') as categoryAliases from oq2js_jbusinessdirectory_companies cp2 left join oq2js_jbusinessdirectory_company_category cc on cp2.id=cc.companyId left join oq2js_jbusinessdirectory_categories cg on cg.id=cc.categoryId and cg.published=1 where 1 AND cp2.package_id>1000 and cc.categoryId in (,1266) group by cp2.id ) as cp left join oq2js_jbusinessdirectory_company_category cc on cp.id=cc.companyId left join oq2js_jbusinessdirectory_categories cg on cg.id=cc.categoryId and cg.published=1 left join oq2js_jbusinessdirectory_categories bc on bc.id=cp.mainSubcategory and bc.published=1 #left join oq2js_jbusinessdirectory_company_contact cnt on cp.id=cnt.companyId left join oq2js_jbusinessdirectory_company_types ct on cp.typeId=ct.id left join oq2js_jbusinessdirectory_orders inv on inv.company_id=cp.id left join oq2js_jbusinessdirectory_packages p on (inv.package_id=p.id and p.status=1 and 0) or (p.price=0 and p.status=1 and 0) left join oq2js_jbusinessdirectory_package_fields pf on p.id=pf.package_id left join oq2js_jbusinessdirectory_company_attributes AS ca on ca.company_id=cp.id where 1 and cc.categoryId in (,1266) and cp.state=1 and (cp.approved = 2 or cp.approved= -1 or cp.approved= 0) group by cp.id order by cp.name ) as slec left join oq2js_jbusinessdirectory_company_ratings cra on cra.companyId=companyId1 group by companyId1 order by featured desc, packageOrder desc LIMIT 0, 20

Go Back Home