SHARE
TWEET

Untitled

Pionez May 6th, 2020 690 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT p.Entidade,
  2.        c.Nome,
  3.        dv.Documento,
  4.        dv.Descricao,
  5.        YEAR(p.DataDoc) AS Ano,
  6.        SUM(p.ValorTotal) AS ValorTotal,
  7.        SUM(p.ValorPendente) AS ValorPendente
  8. FROM dbo.Pendentes p WITH(NOLOCK)
  9.      INNER JOIN dbo.DocumentosVenda dv WITH(NOLOCK) ON p.TipoDoc = dv.Documento
  10.      INNER JOIN dbo.Clientes c WITH(NOLOCK) ON p.Entidade = c.Cliente
  11. WHERE p.TipoEntidade = 'C' AND YEAR(p.DataDoc)=YEAR(GETDATE()) AND p.Entidade=20000038
  12. GROUP BY YEAR(p.DataDoc),
  13.          p.Entidade,
  14.          c.Nome,
  15.          dv.Documento,
  16.          dv.Descricao;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top