Error Query en SELECT articulos.* , temas_por_articulo.tema FROM `articulos` LEFT OUTER JOIN temas_por_articulo ON = temas_por_articulo.articulo having articulos.sys_delete is null and temas_por_articulo.tema= order by STR_TO_DATE(fecha, '%d/%m/%Y') desc 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 STR_TO_DATE(fecha, '%d/%m/%Y') desc' at line 1