By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table t as
select 1 as id, 1 as timeslot_id, 10 as slots_available union all
select 2 as id, 3 as timeslot_id, 2 as slots_available union all
select 3 as id, 8 as timeslot_id, 3 as slots_available union all
select 4 as id, 9 as timeslot_id, 10 as slots_available union all
select 5 as id, 2 as timeslot_id, 10 as slots_available union all
select 6 as id, 6 as timeslot_id, 10 as slots_available union all
select 7 as id, 4 as timeslot_id, 10 as slots_available
Records: 7 Duplicates: 0 Warnings: 0
select t.*
from (select t.*,
sum(case when slots_available >= 3 then 1 else 0 end) over
(order by id
rows between current row and 3 following
) as cnt
from t
) t
where cnt = 3 + 1;
id | timeslot_id | slots_available | cnt |
---|---|---|---|
3 | 8 | 3 | 4 |
4 | 9 | 10 | 4 |