I am trying to get a value and the value just before using SQLPLUS in Aspen V8.8 query.
I found on Oracle library the function "LAG" that seemed perfect to me. But I get errors when using this function
below is my code :
SELECT IP_TREND_VALUE, IP_TREND_TIME, LAG(IP_TREND_VALUE,1,0) OVER (ORDER BY IP_TREND_TIME) as valeur_prec from IP_DIDef_1 WHERE name='my_value' and IP_TREND_TIME BETWEEN '15-APR-19 00:00:00' and '28-APR-19 00:00:00' ORDER BY IP_TREND_TIME
with this code, I get an error "expecting reserved word FROM". Could you please tell me where is my mistake, or how I could do things to get things differenly ?
Thanks a lot
regards