XPath sum
Last modified: April 21, 2023
1 Overview
The sum()
function returns the sum of its argument.
The function must specify a column in the query to aggregate (for example, /TotalPrice
).
The query must specify an attribute that has a numeric type.
2 Examples
This query returns the sum of the total prices of all placed orders:
sum(//Sales.Order/TotalPrice)
This query returns the sum of the total prices of all the orders placed by a customer named “Jansen”:
sum(//Sales.Order[Sales.Customer_Order/Sales.Customer/Name = 'Jansen']/TotalPrice)
Feedback
Was this page helpful?
Glad to hear it! Thank you for your response.
Sorry to hear that. Please tell us how we can improve.