Did you know that SUM() aggregate can be used together with OVER() clause? A short intro to windowing functions:

The result is graphically visualized by using only SQL Server Management Studio and unicode characters:

Tagged with: , , , ,