Skip to main content

SQL query to get cumulative sum of column

SQL query to get cumulative sum of column

select Idcolumn, numericalcolumn, (select max(numericalcolumn)+numericalcolumn
                                                    from  tblAnnexure
                                                    where    tblAnnexure.Idcolumn< Ann.Idcolumn) as CumulativeSum
        from    tblAnnexure Ann


Comments

Popular posts from this blog

Resolving 'Setup Account Privileges' error while installing SQL Server

A new installation of Microsoft SQL Server 2012 or Microsoft SQL Server 2008 R2 fails You see the following error message when you try to install a new instance of SQL Server 2012 or SQL Server 2008 R2: Rule "Setup account privileges" failed.

Creating package in Oracle Database using Toad For Oracle

What are Packages in Oracle Database A package is  a group   of procedures, functions,  variables   and  SQL statements   created as a single unit. It is used to store together related objects. A package has two parts, Package  Specification  and Package Body.