select Ano,Conta=count(*) from MovProduto With (NoLock) Where IsNull(DocID,'')<>'' group by ano Select MovProduto.Ano,Mes=Substring(MovProduto.Data,6,2) ,Lin=(Select count(*) from MovProduto as MP With (NoLock) where MP.Ano=MovProduto.Ano and Substring(MP.Data,6,2)=SubString(MovProduto.Data,6,2) and MP.CliFor='C' and MP.QuantNormal<>0 and isnull(MP.DocID,'')='' ) ,LinWeb=(Select count(*) from MovProduto as MP With (NoLock) where MP.Ano=MovProduto.Ano and Substring(MP.Data,6,2)=SubString(MovProduto.Data,6,2) and MP.CliFor='C' and MP.QuantNormal<>0 and isnull(MP.DocID,'')<>'' ) ,Docs=(Select Count(Distinct Tipo+Numero) from MovProduto as MP With (NoLock) where MP.Ano=MovProduto.Ano and Substring(MP.Data,6,2)=SubString(MovProduto.Data,6,2) and MP.CliFor='C' and MP.QuantNormal<>0 and isnull(MP.DocID,'')='' ) ,DocsWeb=(Select Count(Distinct Tipo+Numero) from MovProduto as MP With (NoLock) where MP.Ano=MovProduto.Ano and Substring(MP.Data,6,2)=SubString(MovProduto.Data,6,2) and MP.CliFor='C' and MP.QuantNormal<>0 and isnull(MP.DocID,'')<>'' ) ,TiposMovWeb=(Select Count(Distinct Tipo) from MovProduto as MP With (NoLock) where MP.Ano=MovProduto.Ano and Substring(MP.Data,6,2)=SubString(MovProduto.Data,6,2) and MP.CliFor='C' and MP.QuantNormal<>0 and isnull(MP.DocID,'')<>'' ) from MovProduto With (NoLock) where MovProduto.Ano>='2024' and MovProduto.Ano<='2026' and MovProduto.CliFor='C' and MovProduto.QuantNormal<>0 group by MovProduto.Ano,Substring(MovProduto.Data,6,2) Order by MovProduto.Ano,Substring(MovProduto.Data,6,2)