SQL ERROR: 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 's.amenityString like '%interiorBalcony%' ) AND s.isHousePlan = 1 AND s.isNotDupl' at line 3
SQL TEXT: select 'buildingCategory' groupField, buildingCategory data, buildingCategory description,
   count(buildingCategory) row_count
   from search s where (s.amenityString like '%%' s.amenityString like '%interiorBalcony%' ) AND s.isHousePlan = 1 AND s.isNotDuplex = 1 
   group by buildingCategory
  union all
  select 'garageType' groupField, garageType data, garageDescription description,
   count(garageType) row_count
   from search s where (s.amenityString like '%%' s.amenityString like '%interiorBalcony%' ) AND s.isHousePlan = 1 AND s.isNotDuplex = 1 
   group by garageType, garageDescription
  union all 
  select 'finishedArea' groupField,
   criteria, description, count(criteria) row_count
   from (select distinct id, finishedAreaRange sort,
  concat('area ',(case when finishedAreaRange = 1 then 'less than 1000'
      when finishedArea = 2 then 'between 1000 and 1499'
      when finishedArea = 3 then 'between 1500 and 1999'
      when finishedArea = 4 then 'between 2000 and 2499'
      when finishedArea = 5 then 'between 2500 and 2999'
      when finishedArea = 6 then 'between 3000 and 3499'
      when finishedArea = 7 then 'greater than 3500' end), ' sq ft') criteria,
  concat((case when finishedArea = 1 then 'area < 1000'
      when finishedArea = 2 then 'area 1000 - 1500'
      when finishedArea = 3 then 'area 1500 - 2000'
      when finishedArea = 4 then 'area 2000 - 2500'
      when finishedArea = 5 then 'area 2500 - 3000'
      when finishedArea = 6 then 'area 3000 - 3500'
      when finishedArea = 7 then 'area > 3500' end), ' sq ft') description
  from search s where (s.amenityString like '%%' s.amenityString like '%interiorBalcony%' ) AND s.isHousePlan = 1 AND s.isNotDuplex = 1 ) as qp group by sort, criteria, description
  union all
  select 'architecturalInfluence' groupField, architecturalInfluence data,
   architecturalInfluenceDescription description,
   count(architecturalInfluence) row_count
  from search s where (s.amenityString like '%%' s.amenityString like '%interiorBalcony%' ) AND s.isHousePlan = 1 AND s.isNotDuplex = 1 
  group by architecturalInfluence, architecturalInfluenceDescription