Subject | sql procedure InterBase 7.5 |
---|---|
Author | aleplgr |
Post date | 2007-03-22T18:07:26Z |
Hi! I hope this is the right forum, if not please let me know.
I'm working with EMS SQL MANAGER 2005 for INTERBASE, my InterBase
version is 7.5 and I need to create a sql procedure that recieves
one table as input and creates one table as output.
My input is a 3 columns table: ClientID, Date2 and Date1, for each
ClientID there may be several Date1 and Date2 values
Now I have this:
ClientID Date2 Date1
1 a b
1 c d
1 e f
And I need to calculate the difference between the actual Date1 and
the next Date2 for each row until this difference is >30.
The difference for the first row is c-b, the difference for the
second row is e-d.
I need to return a table with 2 columns: ClientID and Date1.
This Date1 is the first such that the difference is greater than 30
days, for each ClientID.
If there's no Date1 which difference is greater than 30 days return
the last Date1 for this ClientID.
Thanks in advance
I'm working with EMS SQL MANAGER 2005 for INTERBASE, my InterBase
version is 7.5 and I need to create a sql procedure that recieves
one table as input and creates one table as output.
My input is a 3 columns table: ClientID, Date2 and Date1, for each
ClientID there may be several Date1 and Date2 values
Now I have this:
ClientID Date2 Date1
1 a b
1 c d
1 e f
And I need to calculate the difference between the actual Date1 and
the next Date2 for each row until this difference is >30.
The difference for the first row is c-b, the difference for the
second row is e-d.
I need to return a table with 2 columns: ClientID and Date1.
This Date1 is the first such that the difference is greater than 30
days, for each ClientID.
If there's no Date1 which difference is greater than 30 days return
the last Date1 for this ClientID.
Thanks in advance