Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a table structured like this:
Date_Débit | Date_Crédit |
01/02/2013 | |
01/04/2013 | |
12/04/2013 | |
01/05/2013 | |
10/06/2014 | |
12/08/2014 |
i want to add a new column with end_date_of Debit to store the next field in Date_Crédit column like that:
Date_Débit | Date_Crédit | Date_Fin_Débit |
01/02/2013 | 01/04/2013 | |
01/04/2013 | ||
12/04/2013 | ||
01/05/2013 | ||
10/06/2014 | 12/08/2014 | |
12/08/2014 |
Any idea how can i do that in the script so i can calculate duration of debit ?
Thank you so much
Try this:
Table:
LOAD RowNo() as Sort,
*;
LOAD * Inline [
Date_DEBIT, date_CREDIT
01/01/2013,
01/03/2013,
, 01/04/2013
];
FinalTable:
LOAD *,
If(Len(Trim(date_CREDIT)) = 0, Alt(Peek('date_fin_debit'), Peek('date_CREDIT'))) as date_fin_debit
Resident Table
Order By Sort desc;
DROP Table Table;
May be this:
Table:
LOAD RowNo() as Sort,
*;
LOAD * Inline [
Date_Débit, Date_Crédit
01/02/2013,
,01/04/2013
,12/04/2013
,01/05/2013
10/06/2014,
,12/08/2014
];
FinalTable:
LOAD *,
If(Len(Trim(Date_Crédit)) = 0, Peek('Date_Crédit')) as Date_Fin_Débit
Resident Table
Order By Sort desc;
DROP Table Table;
Try this:
Table:
LOAD RowNo() as Sort,
*;
LOAD * Inline [
Date_DEBIT, date_CREDIT
01/01/2013,
01/03/2013,
, 01/04/2013
];
FinalTable:
LOAD *,
If(Len(Trim(date_CREDIT)) = 0, Alt(Peek('date_fin_debit'), Peek('date_CREDIT'))) as date_fin_debit
Resident Table
Order By Sort desc;
DROP Table Table;