string(1458) " FROM TabSolicita M INNER JOIN TabTipoMateria T ON M.NTipoReq = T.IdTipoMat LEFT JOIN ( SELECT r.NReq, r.NSituacao, a.Descricao AS DescSituacao FROM tabsubreq r INNER JOIN tabtiposituacao a ON r.NSituacao = a.IdTipoSituacao WHERE (r.NReq, r.DataTramite, r.ID) IN ( SELECT NReq, MAX(DataTramite) AS DataTramite, MAX(ID) AS ID FROM tabsubreq GROUP BY NReq ) ) c ON M.IdSolicita = c.NReq LEFT JOIN tabmateriacategoria G ON T.NCategoria = G.IdMateriaCategoria LEFT JOIN tabtiposituacao ts ON M.Situacao = ts.IdTipoSituacao WHERE (M.Site = 'S' OR M.Site IS NULL) AND M.Situacao IN ('A', 'F', '2') AND IdSolicita IN (SELECT DISTINCT(N_Requerimento) FROM TabSubSolicita WHERE N_Vereador = :ver AND COALESCE(Subscritor, '') = '') "