-
SQL -Sum function
Hi,
Table
A B---------------------------COLUMN
A1 B1
A2 B2
A3 B3
A4 B4
....
I need the sum of data in column A and column B such that
A B SUM---------------------------COLUMN
A1 B1 A2+B1
A2 B2 A3+B2
A3 B3 A4+B3
A4 B4 A5+ B4 ...
Please help.. :confused:
-
your requirement isnt clear, you want to sum up the value of b from one row and a from the next row?
If so that aint possible as rows dont have an order in heap tables. you will need to use additional column to get what you want
-
Yes i need to add value from B to other value from A.
But how will adding a column help me ..
Plz help... :confused:
-
how do you know which other row you want to get - what is your criteria
-
Use analytic function lead to access next row.
Tamil
-
Yes, but you MUST have an ORDER BY as Davey was insisting.
Itrat, how do you want to order the rows?