SQL sum of sum totals

-1

I would like to help me. This time with a summation of sum totals of other sums.

The error tells me that:

  

The sum function requires 1 argument.

Something about the code:

select
    colum1 as Total,
    colum2 as Co,
    Sum (price) as [Total],
    Sum(Amount) as TotalMes,
    Sum (NatAmount) as PrecioNal,
    Sum (Price,Amount,NatAmount) as TotalCo
From
    Articulos,
    Tickets
Where
    fecha Between '2017-01-01' and '2017-01-31'
Group by
    Column1,
    Column2,
    Price,
    Amount,
    NatAmount
order by
    Total asc

Thank you.

    
asked by Jose Gil 10.12.2018 в 15:04
source

1 answer

1

I think that the following would work for you:

select
   colum1 as Total,
   colum2 as Co,
   CAST(Sum (price) AS float) as PrecioTotal,
   CAST(Sum(Amount) AS float) as TotalMes,
   CAST(Sum (NatAmount) AS float) as PrecioNal,
   (PrecioTotal + TotalMes + PrecioNal) as TotalCo
From
   Articulos,
   Tickets
Where
   fecha Between '2017-01-01' and '2017-01-31'
Group by
   Column1,
   Column2,
   Price,
   Amount,
   NatAmount
order by
   Total asc

Try it and tell me. Mind you I changed an alias out there.

    
answered by 10.12.2018 / 17:18
source