error en query: SELECT c.IdInstFin, s.Nombre, i.NOMBREIF, i.C_STATUS, i.logo, i.IdStatusBuro, c.RecTotal, c.RecIndiceResolucion, c.RecTiempoRespuesta, F_IDATU_Total(c.IdInstFin,c.IdPeriodo) AS RecIndiceDesempeno, c.SancionTotal, c.SancionMonto, F_PracticasNoSanasTotalGral(c.IdInstFin,c.IdPeriodo) AS PracticasNoSanasTotalGral, F_AbusivasTotalGral(c.IdInstFin,c.IdPeriodo) AS AbusivasTotalGral, r.CumpleCalificacion, (SELECT count(edufin_aplica) FROM bef_ifit_edufin WHERE id_institucion = c.IdInstFin AND edufin_aplica='si' AND IdPeriodo = c.IdPeriodo) AS EduFin, F_CalificacionGeneral(c.IdInstFin,c.IdPeriodo) AS CalificacionGral, p.Texto, c.IdPeriodo, IF(i.C_SECSHCP = 4, (SELECT CONCAT_WS('|',IndiceReclamacion,SB1,SB2,SB3,SB4,SB5,SB6,SB7,SB8,SB9,SB10,ComisionSaldo) FROM bef_ComportamientoGralAfore WHERE IdInstFin = c.IdInstFin AND IdPeriodo=c.IdPeriodo),'NA') AS DatosAfore, IF(i.C_SECSHCP = 69, (SELECT CONCAT_WS('|',a.ActividadNombre,b.AsoNombre,IF(d.RecoNoObs is null,0,d.RecoNoObs),d.IdEdoRenovacion) FROM bef_ComportamientoGralSOFOM AS d Inner Join bef_catActividad AS a ON d.IdActividad = Inner Join bef_catAsociacion AS b ON d.IdAsociacion = WHERE d.IdInstFin = c.IdInstFin AND d.IdPeriodo = c.IdPeriodo),'NA') AS ActividadAsociacion, IF(i.C_SECSHCP = 61, (SELECT CONCAT_WS('|',recBancos,recSofom_ER,recSofom_ENR,IF(recOrgSocial is null,0,recOrgSocial),recSocaps,recSoFiPo,Otros,recCondusef) FROM bef_ComportamientoGralSIC WHERE IdInstFin = c.IdInstFin AND IdPeriodo=c.IdPeriodo),'NA') AS DatosSic, IF(i.C_SECSHCP = 40, (SELECT a.GpoNombre FROM bef_ComportamientoGralBancos AS d Inner Join bef_catGrupo AS a ON d.IdGrupo = WHERE d.IdInstFin = c.IdInstFin AND d.IdPeriodo = c.IdPeriodo),'NA') AS GpoBancos, IF(i.C_SECSHCP = 58 || i.C_SECSHCP = 26 || i.C_SECSHCP = 76 || i.C_SECSHCP = 52 || i.C_SECSHCP = 71 || i.C_SECSHCP = 7 || i.C_SECSHCP = 55 || i.C_SECSHCP = 64, (SELECT CONCAT_WS('|',CumpleSIPRES,CumpleRECA,CumpleRECO,CumpleREUNE,CumpleIFIT,CumpleREDECO) FROM bef_RegCumplimiento WHERE IdInstFin=c.IdInstFin and IdPeriodo=c.IdPeriodo),'NA') as datosRegistro FROM bef_ComportamientoGral AS c Inner Join buro_Periodo AS p ON c.IdPeriodo = p.IdPeridodo Inner Join bef_InstFin AS i ON c.IdInstFin = i.IdInstiFin AND c.IdPeriodo = i.IdPeriodo AND p.IdPeridodo = i.IdPeriodo Inner Join bef_Sector AS s ON i.C_SECSHCP = s.idSector Inner Join bef_RegCumplimiento AS r ON r.IdInstFin = i.IdInstiFin AND r.IdPeriodo = i.IdPeriodo WHERE i.IdStatusBuro = 1 AND i.C_SECSHCP = 69 AND c.IdPeriodo = 25������ ORDER BY c.RecIndiceResolucion desc, c.RecTotal desc, i.NOMBREIF 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 '¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ORDER BY c.RecIndiceResolucion desc, c.RecTotal d' at line 59