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 'AND areas_trabajos.id_area = areas.id GROUP BY areas.id' at line 1