Errore nel comando sql (SELECT sp_dett_spese.id,idutente,utenti.cognome, utenti.nome, IF(ISNULL(sp_dett_spese.annoscol),'2023-2024',sp_dett_spese.annoscol) as ann_scol, date_format(data_doc,"%d-%m-%Y") as data_doc, date_format(data_ins,"%d-%m-%Y %H:%i") as data_ins, descrizione, tipo_acquisto, tipo_documento, estremi_documento, fornitore, importo, inviato, sp_dett_spese.email, refid_docente, filesize, non_ammesso FROM `utenti` left join sp_dett_spese on sp_dett_spese.refid_docente=idutente LEFT JOIN sp_aventi_diritto ON utenti.idutente = sp_aventi_diritto.refid_utente WHERE idcategoria=2 and idutente>1 and attivo=1 and sp_aventi_diritto.id IS NOT NULL and idutente= order by cognome ASC, nome ASC, sp_dett_spese.annoscol DESC): (1064) 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 cognome ASC, nome ASC, sp_dett_spese.annoscol DESC' at line 1