O'Reilly logo

Inside Microsoft® SQL Server™ 2005: T-SQL Querying by Dejan Sarka, Lubor Kollar, Itzik Ben-Gan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

OVER Clause

The OVER clause allows you to request window-based calculations—that is, the calculation is performed on a whole window of values. In Chapter 4, I described in detail how you use the OVER clause with the new analytical ranking functions. Microsoft SQL Server 2005 also introduces support for the OVER clause with scalar aggregate functions; however, currently it can be used only with the PARTITION BY clause. Hopefully, future versions of SQL Server will also support the other ANSI elements of aggregate window functions, including the ORDER BY and ROWS clauses.

The purpose of using the OVER clause with scalar aggregates is to calculate, for each row, an aggregate based on a window of values that extends beyond the scope of the row—and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required