Roger Brushless
SELECT T0.data,T0.id,T0.showData,T0.idPadre,T0.pageName, T2.Testo,T1.testo As titolo,TTA.testo AS richiamo, (SELECT COUNT(Id) AS Tot FROM TBLCommenti TC WHERE TC.IdContent = T0.Id AND TC.IdLingua = 020) AS TotComments, (SELECT TOP 1 pathOggetto FROM TBLAssociaOggetti TObj WHERE TObj.IdArea = 66 AND TObj.IdCampo = T0.Id AND TObj.numFoto = 3 AND TObj.tipoOggetto < 3 ORDER BY TObj.Ordina) AS Foto FROM TBLContent T0 INNER JOIN TBLContent TF ON TF.id = T0.idPadre INNER JOIN TBLTesti T1 ON T1.idArea = 66 AND T1.idTipoTesto = 06 AND T1.idCampo = T0.id AND T1.idLingua = 020 AND T1.attiva = 1 INNER JOIN TBLTesti T2 ON T2.idArea = 66 AND T2.idTipoTesto = 06 AND T2.idCampo = T0.id AND T2.idLingua = 020 LEFT JOIN TBLTesti TTA ON TTA.idArea = 66 AND TTA.idTipoTesto = 08 AND TTA.idCampo = T0.id AND TTA.idLingua = 020 WHERE T0.idPadre = 01297 AND T0.sospendi<>1 AND ISNULL(T0.IsPrivate, 0) <> 1 AND T0.Id NOT IN (02600,02219,02226,022851) ORDER BY T0.ordina,T0.data desc