SUM in SQL Server 2014

Can you help me to make the sum of all the values ​​of the "Total_Profit" row that is in partition 1 of my database.

select 
    Total_Profit, 
    $partition.FUNCIONDEPARTICION2(Order_Priority) 
from 
    cliente 
where 
    $partition.FUNCIONDEPARTICION2(Order_Priority) = 1 

In this query I already show all the values ​​but I don't know how to add them

Upvotes: 0

Views: 50

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1270553

Just use SUM():

select SUM(Total_Profit)
from cliente 
where $partition.FUNCIONDEPARTICION2(Order_Priority) = 1 

Upvotes: 2

Related Questions