Subject RE: [firebird-support] sql procedure InterBase 7.5
Author Alejandro Garcia
No, I don't need a real table, in fact I need an excel table, so I could create the procedure and the result table to excel.. I'm new to EMS SQL MANAGER, it's possible to export the procedure result to excel isn't it?
If the differences were both greater than 30 select the first one , in fact always stop the search when find one that's greater than 30
Thanks for your help

"Leyne, Sean" <Sean@...> escribió:

> 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






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

LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com

[Non-text portions of this message have been removed]