+1 vote
in Sql by

What is TSQL Window functions?

1 Answer

0 votes
by

A window function is a function that's applied to a set of rows defined by a window descriptor and returns a single value for each row from the underlying query. The purpose of the window descriptor is to define the set of rows that the function should apply to. You provide the window specification using a clause called OVER.

SELECT empid, ordermonth, qty,
  SUM(qty) OVER(PARTITION BY empid
        ORDER BY ordermonth
        ROWS BETWEEN UNBOUNDED PRECEDING
             AND CURRENT ROW) AS runqty
FROM Sales.EmpOrders;

Related questions

+2 votes
+2 votes
0 votes
+1 vote
asked Jan 15, 2022 in Sql by GeorgeBell
+2 votes
asked Jan 15, 2022 in Sql by GeorgeBell
...