string(690) " from tablicitacao l LEFT JOIN TabModLicita m on (l.NModalidade = m.IdModLicita) INNER JOIN (select DtAndamento, Descricao, NLicita, NSituacao from tablicitacaoandamento where IdLicitacaoAndamento IN (select max(IdLicitacaoAndamento) from tablicitacaoandamento group by NLicita)) j on (l.IdLicita = j.NLicita) INNER JOIN tabsituacaolicita s ON (j.NSituacao = s.IdSitacaoLicita) LEFT JOIN tablicitalocais o ON (l.NLicitaLocais = o.IdLicitaLocais) LEFT JOIN tabtipolicita t ON (l.NTipoLicit = t.IdTipoLicita) LEFT JOIN tablicitarepublic p ON (p.NLicita = l.IdLicita) where Site = 'S' AND (Carona = 'S') AND l.DtDelete IS NULL "