Invalid query: 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 'order by date' at line 1 Whole query: select competitions.date,0 as indic,concat('Etape ',compete) as indicateur,rang from resultats left join compet_categories on compet_categories.idcateg=resultats.compete left join competitions on competitions.id=compet_categories.idcompet where concu= order by date