SQLite Forum

Help calculating data when answers in previous row
Login
> `window win1 as (rows 1 preceding)`

I think this is incorrect. The frame specification is not relevant for the `lag` function, which always uses the previous row, so "`rows 1 preceding`" is redundant. However, I think that you do need to specify the order.

> `count(event IS 'Game Completed Final Balance')`

This is not right either, I think. In this case, the `IS` expression results 0 or 1 (never null), so `count` will count all of the rows. What should be needed here is `sum` or `total`, not `count`.