SQLize Online / PHPize Online  /  SQLtest Online

Share      Blog   Popular
Copy Format Clear
with sub as ( select generate_series('2023-02-01', '2023-02-28', interval '1 day')::date as dt, (random() * 10 + 1)::numeric(5, 2) as cur ) select dt, case when extract(dow from dt) in (0, 6) then null else cur end as cur into t from sub; --решение select dt, cur, first_value(cur) over(partition by n order by dt) as fix_cur from ( select dt, cur, sum(case when cur is not null then 1 else 0 end) over (order by dt) as n from t )foo
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear