Skip to content
Advertisement

how to sum a column in SQL?

I am multiplying two columns of my view vDetalleEventoCaracteristicas and showing it in the Total column but now I want to sum all the records of the Total column

How could I do that?

enter image description here

Advertisement

Answer

SELECT SUM(Total) AS Total_Sum
FROM (
    SELECT *,(Cantidad * valor) AS Total
    FROM vDetalleEventoCaracteristicas
    WHERE idevento = @IdEvento
)table_alis

Use this query you will get sum of Total column.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement