Chcesz lag()
:
select
articleid,
amount,
date,
lag(date) over(partition by articleid order by date) prevdate,
lag(amount) over(partition by articleid order by date) prevamount
from table1
order by articleid, date desc
Chcesz lag()
:
select
articleid,
amount,
date,
lag(date) over(partition by articleid order by date) prevdate,
lag(amount) over(partition by articleid order by date) prevamount
from table1
order by articleid, date desc