Tuesday, 29 March 2016

[firebird-support] How to add previous column value to current value?

 

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

 

__._,_.___

Posted by: "Piotr Olszewski" <piotr.olszewski@eskrzynka.pl>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.

__,_._,___

No comments:

Post a Comment