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 'DISTINCT DATE(fecha), DAY(fecha) AS 'day_fecha', MONTH(fecha) AS 'month_fecha', ' at line 1