declare @CabDoc Table ( Codigo int, Data datetime, Entid...

0

Please login or register to vote for this query.

(click on this box to dismiss)

History of Science and Math

Q&A for people interested in the history and origins of science and mathematics

declare @CabDoc Table
(

Codigo int,
Data datetime,
Entidade int,
Valor int
)


declare @LinDoc Table
(

CodigoCabDoc int,
NumLinha int,
CodArtigo nvarchar(max),
Descricao nvarchar(max),
Quantidade int,
PrecoUnitario int

)

Select Codigo,
       Data,
       Entidade,
       Quantidade,
       PrecoUnitario * Quantidade PrecoTotal
  From @CabDoc CabDoc
 Inner Join @LinDoc LinDoc
         On LinDoc.CodigoCabDoc = Codigo
        And LinDoc.CodArtigo = 'XPTO'
 Where cast(CabDoc.Data as date) between cast('2010-01-01' as datetime) and cast('2010-01-31' as datetime)

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results