Reputation: 1
How/Can I specify this window frame:
sum(Quantity) over (partition by AccountId, SymbolId order by Time rows between unbounded preceding and current row -1) PositionAmount?
I tried to full it by
sum(Quantity) over (partition by AccountId, SymbolId order by Time rows between unbounded preceding and -1 following)
but -1 is not allowed.
I can of course make a second select over it and find prev value of PositionAmount with lag or something.
Upvotes: 0
Views: 38
Reputation: 7250
The documention specifies, in case you use between
, that both parts are window frame bound
, without forcing you to use following
for the second part. Try this:
rows between unbounded preceding and 1 preceding
Upvotes: 2