Subject How to add previous column value to current value?
Author Piotr Olszewski

Hi

 

 

I need to get a date difference (days between) between rows.

 

Let say i have:

 

Name                   Date

---------------------------

Name1                 date1

Name2                 date2

Name3                 date3

 

Order by date

 

I need something like this

 

Name                   Date                      Days betwen Previous date

----------------------------------------------------------------------

Name1                 date1                    0

Name2                 date2                    date2-date1

Name3                 date3                    date3-date2

 

 

sql is generated dynamically and it's quite complicated so i can't use procedure to do this.

 

 

 

Regards

 

Piotr Olszewski