sum(), sum_y(), and sum_x()

sum(summary StatsSummary1D, method TEXT) RETURNS BIGINT
sum_y(summary StatsSummary2D, method TEXT) RETURNS BIGINT
sum_x(summary StatsSummary2D, method TEXT) RETURNS BIGINT

Get the sum of the values contained in a statistical aggregate.

In a two-dimensional stats_agg use the _y/ _x form to access the sum of the dependent and independent variables.

For more information about statistical aggregate functions, see the hyperfunctions documentation.

Required arguments

NameTypeDescription
summaryStatsSummary1D / StatsSummary2DThe already constructed data structure from a previous stats_agg call

Returns

ColumnTypeDescription
sum/sum_y/sum_xDOUBLE PRECISIONThe standard deviation of the values in the statistical aggregate

Sample usage

SELECT sum_y(stats_agg(data, data))
FROM generate_series(0, 100) data;
sum_y 
-------
  5050

Found an issue on this page?

Report an issue!

Related Content