Forum Discussion
PeterBartholomew1
Jan 18, 2025Silver Contributor
What do you think of thunks?
OK, so the most likely response by far is going to be "I don't". However, I tried one of Omid Motamedisedeh's regular challenges and found it a suitable problem for exploring some of the lesser k...
peiyezhu
Jan 20, 2025Bronze Contributor
sql:
create temp table aa as
SELECT rowid old_rowid,*, max(`Value`) OVER (
ORDER BY rowid ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING
) AS group_max FROM RollingMax;
select * from aa;
//list max value of each range BETWEEN 2 PRECEDING AND 2 FOLLOWING
select Date,Value from aa where group_max=Value order by old_rowid;
//filter Value equal group_max
peiyezhu
Jan 20, 2025Bronze Contributor
select Date,Value from (SELECT rowid old_rowid,*, max(`Value`) OVER (
ORDER BY rowid ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING
) AS group_max FROM RollingMax) where group_max=Value order by old_rowid;
2 lines merge to one row