Toad World® Forums

Delta Value on the same column in a Query

I have question about delta value on the same column.

I have a list of values in a query’s column.

How it’s possible to calculate for every raw current raw value - previous raw value in a query ? , using an easy query to do this delta ?

Thanks

Samilag

Hello Samilag,

Your question is provider specific which means the query you are looking for will be different in MS SQL Server and different in Oracle (for example). What provider are you using?

Using google i found samples for MS SQL server:

http://blog.sqlauthority.com/2013/09/22/sql-server-how-to-access-the-previous-row-and-next-row-value-in-select-statement/

http://stackoverflow.com/questions/710212/is-there-a-way-to-access-the-previous-row-value-in-a-select-statement

I believe if you type “xxxx get previous row value” where xxxx is name of the provider that you are using you should get the information you need.

Hope this helps

Martin