looks like semi-working

This commit is contained in:
msyu
2025-08-22 17:33:59 +03:00
parent 3d2a6a3552
commit e7628f9100
12 changed files with 604 additions and 3 deletions
+15
View File
@@ -0,0 +1,15 @@
with siv (dt_from, agreement_version, line_version, agreement_is_actual, siv_is_actual, cost, prob)
as (VALUES
('2025-01-01'::date, 1, 1, true, true, 100, 100),
('2025-02-01', 1, 10, false, true, 200, 10),
('2025-02-01', 1, 12, true, true, 200, 100),
('2025-03-01', 2, 20, true, true, 100, 100),
('2025-03-01', 2, 21, true, true, 150, 100),
('2025-02-15', 3, 30, true, true, 300, 100),
('2025-04-01', 4, 40, false, true, 100, 100)
)
SELECT
(LAST_VALUE (dt_from) OVER (ORDER BY dt_from, agreement_version,line_version RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)),
--coalesce((LEAD(dt_from) OVER (ORDER BY dt_from, agreement_version,line_version)), (select max(dt) from elma.mv_dt)) dt_next,
*
from siv