You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') and a.fecha_noticia <= '2024-06-01' ORDER BY a.fecha_noticia desc, a.id_not...' at line 1