Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular

SQLize.online is a free online SQL environment for quickly running, experimenting with and sharing code. You can run your SQL code on top of the most popular RDBMS including MySQL, MariaDB, SQLite, PostgreSQL, Oracle and Microsoft SQL Server.

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