Error Query en select * from cursadas where sys_delete is null and habilitada='S' and curso=NO ENCONTRADO order by STR_TO_DATE( inscripcion, '%d/%m/%Y') asc 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 'ENCONTRADO order by STR_TO_DATE( inscripcion, '%d/%m/%Y') asc' at line 1