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 ed.attivo=1 AND sf.attivo=1 ORDER BY sf.sala ASC' at line 1