Subject RE: [firebird-support] sql procedure InterBase 7.5
Author Leyne, Sean
> 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.

Do you need a real table or would a stored procedure be acceptable?


> 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.

What would be returned if difference (c-b) and (e-d_ were both > 30
days?


Sean