Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Could anyone help with this, supposedly, easy exercise? I've got an sql table containing inventory values at certain points of time e.g.:
Date, Value
2009-01-01, 10
2009-06-30, 9
2009-12-31, 12
2010-01-01, 7
and would like to find difference between the last and the first within a period to get:
-1 for 01-06.2009
2 for 01-12.2009
0 for 01-12.2010 (one record is the first and the last at the same time)
Due to the complexity of the rest of the script I need to set it within sql code.
Thanks, Przemek
Hi,
If my understanding is correct, the following load script will fulfill your need.
LOAD
date,
value,
(value - Previous(value)) as diff;
SQL SELECT
date,
value
FROM
sqlTable;
This will load each data from your sql table along with difference from your last record.
Regards,
Hi,
If my understanding is correct, the following load script will fulfill your need.
LOAD
date,
value,
(value - Previous(value)) as diff;
SQL SELECT
date,
value
FROM
sqlTable;
This will load each data from your sql table along with difference from your last record.
Regards,