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 ')' 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 (reciprocity = 'Yes' or reoffice = 'RE/MAX Westcoast' or reoffice2 = 'RE/MAX Westcoast' or reoffice3 = 'RE/MAX Westcoast') and `table` in ('mlsr_listings') and `status` = 'Active' and ()