|
-
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..
-
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...
-
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?
"The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|