finally I found the solution, rename the variable date and change it in the sentence having. SELECT creditos.NombreCliente, creditos.Contrato, creditos.Rut, creditos.lIdtplCabezaCotiza, creditos.FechaPagare, creditos.FechaCurse, creditos.FechaVcto1, creditos.FechaVcto2, creditos.FormaPago, creditos.EstadoMandato, REPLACE (CuentaCorriente, ‘,’, ‘.’) AS CuentaCorriente, creditos.Sucursal, creditos.cFyI, creditos.FechaUltimoPago, estado_creditos_banco.`Fecha Activación` AS FechaActivacion, estado_creditos_banco.`Detalle de Rechazo` AS DetalleRechazo, MAX( estado_creditos_banco.`Fecha Recepción CCA` ) as fecha, estado_activos_banco.Observaciones, estado_creditos_banco.`Estado General` … Read more