Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to write the SQL query for generating triangular numbers

Tyro.Vins-OracleAug 23 2012 — edited Jun 1 2017
Hi,
I have a table ..which stores the sequence number like this

Seq :
1000
1200
1300
1500
1800
1900

Now i want to get a result like this

1000 1000
1200 2200
1300 3500
1500 5000
1800 6800
1900 8700

how can it be achieved. I tried using Lead and lag. but only I can add the n+1 or n-1 results. Please help.
This post has been answered by Centinul on Aug 23 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 20 2012
Added on Aug 23 2012
2 comments
699 views