select date, open_close from moex_fin m
where open_close BETWEEN 3.15 * 0.985 AND 3.15 * 1.005;
select m.date, m.open_close, mo.date, mo.open_close from moex_fin m
JOIN moex_fin mo ON (m.date + 1 = mo.date)
where m.open_close BETWEEN 3.15 * 0.985 AND 3.15 * 1.005;
with d as (
select
date,
open_close,
lead(date) over (order by date asc) next_date,
lead(open_close) over (order by date asc) next_open_close
from moex_fin m
) select * from d
where open_close BETWEEN 3.15 * 0.985 AND 3.15 * 1.005
;