Aggregate. Computes the average of the independent variable of the regression line.
REGR_AVGX( dependent-expression , independent-expression )
dependent-expression | The variable that is affected by the independent variable. |
independent-expression | The variable that influences the outcome. |
AVG( y )
SQL/2003 SQL foundation feature (T621) outside of core SQL.
The following example calculates the average of the dependent variable, employee age.
SELECT REGR_AVGX()( Salary, ( 2008 - YEAR( BirthDate ) ) ) FROM Employees group by depart_IDWith a window:
SELECT REGR_AVGX()( Salary, ( 2008 - YEAR( BirthDate ) ) ) FROM Employees KEEP 10 ROWS