Parrocchie

Invalid query: 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 'AND ist.denominazione<>'' AND inc.attuale=1 AND inc.tipologiaIncaricoId IN (2,5)' at line 19 Whole query: SELECT ist.idIstituzione as istid,ist.denominazione as istden,i.tipoIstituzione as isttipo,ist.indirizzo as istindirizzo,l.idLocalita as istlocalitaId,l.localita as istlocalita, CONCAT(s.cognome,' ',s.titolo,' ',s.nome) as sacerdote, s.idSacerdote as sacid, tinc.tipologiaIncarico as sacincarico, s.nonDiocesano as sacNondiocesano,s.diacono as sacDiacono, s.ordine as sacOrdine, c.categoria as saccategoria FROM istituzione as i LEFT JOIN istituzioni as ist ON i.idTipoIstituzione = ist.tipoId LEFT JOIN incarichi as inc ON inc.istituzioneId=ist.idIstituzione LEFT JOIN tipologieincarico as tinc ON inc.tipologiaIncaricoId=tinc.idTipologiaIncarico LEFT JOIN sacerdoti as s ON inc.sacerdoteId = s.idSacerdote LEFT JOIN categoria as c ON c.idCategoria = s.categoriaId LEFT JOIN localita as l ON l.idLocalita=ist.localitaId LEFT JOIN vicarie as v ON v.idVicaria = l.vicariaId WHERE 1 AND i.idTipoIstituzione=1 AND ist.idIstituzione=40/ AND ist.denominazione<>'' AND inc.attuale=1 AND inc.tipologiaIncaricoId IN (2,5) GROUP BY ist.idIstituzione ORDER BY l.localita ASC