# Untitled

unknown

sql

2 years ago

323 B

1

Indexable

Never

^{}

with sum as ( select line_number, line::int + lead(line, 1) over w::int + lead(line, 2) over w::int as sum from day1 window w as (order by line_number) ), diff as ( select sum::int - lag(sum, 1) over (order by line_number)::int as diff from sum ) select count(*) filter (where diff > 0) from diff ;