string(831) " from tablicitacao l inner 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) INNER 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 (ChamPublic = 'S' ) AND ((l.DataPublicAviso <= CURDATE()) OR (l.DataPublicAviso IS NULL)) AND l.DtDelete IS NULL "