Answer the question
In order to leave comments, you need to log in
Next line data?
Hello.
There is a query that displays 4 lines:
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;
Answer the question
In order to leave comments, you need to log in
PostgreSQL provides function `lead` for this
case
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
;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question