create table test(i number , j number);
insert into test values(1,2)
insert into test values(1,3)
insert into test values(1,4)
select * from test;
I J
---------- ----------
1 2
1 3
1 4
minha intenção:
depois do update
select * from test;
I J
---------- ----------
1 2
1 3+2
1 4+3
depois do update
select * from test;
I J
---------- ----------
1 2
1 5+2
1 7+5
Pra oracle
update test x
set x.j = x.j + (select lag_j
from (select i, j, nvl(lag(j) over (order by i,j) ,0) as lag_j
from test) y
where x.i = y.i and x.j = y.j)
como eu faço isso pra postgres?
Agradeço desde ja
Paulo
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral