string(780) " FROM tabconvenio c LEFT JOIN tabsubconvenio b ON(c.IdConvenio = b.NConvenio) INNER JOIN (Select Id, Descricao from tabconvenioconcedente) cc on (c.NConcedente = cc.Id) INNER JOIN (Select Id, Descricao from tabconvenioconcedente) cv on (c.NConvenente = cv.Id) LEFT JOIN (SELECT b.IdSubConvenio, b.NConvenio, b.NTipo, b.DataMovimento, s.Descricao FROM tabsubconvenio b INNER JOIN tabsituacaoconvenio s ON (b.NTipo = s.Idsituacaoconvenio) group by b.IdSubConvenio ORDER BY b.DataMovimento DESC) s ON(c.IdConvenio = s.NConvenio) WHERE c.Site = 'S' AND c.ValorPactuado > 0 AND c.TipoConvenio = 'E' "