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 'city in ('Vancouver') AND subarea in ('Champlain Heights','Collingwood VE','Fras' at line 1select count(*) as count, group_concat(distinct(`city`)) as 'city', group_concat(distinct(`subarea`)) as 'subarea', group_concat(distinct(`listingtype`)) as 'listingtype', MIN(listprice_2) as 'startingfrom', max(last_mod) as 'last_mod' from boards.listings where status = 'Active' and (reciprocity = 'Yes' or reoffice = 'Sutton Group West Coast Realty' or reoffice2 = 'Sutton Group West Coast Realty' or reoffice3 = 'Sutton Group West Coast Realty') and `table` in ('mlsr_listings') and city in ('Vancouver') city in ('Vancouver') AND subarea in ('Champlain Heights','Collingwood VE','Fraser VE','Fraserview VE','Grandview VE','Hastings','Hastings East','Killarney VE','Knight','Main','Mount Pleasant VE','Renfrew Heights','South Vancouver','Victoria VE') AND listingtype in ('Townhouse')