Hi! Could we please enable some services and cookies to improve your experience and our website?
create table tbl (
col1 int,
col2 int
);
insert into tbl (col1, col2) values (1, 12), (1, 32), (2, 10), (2, 5), (3, 6), (3, 10);
CREATE VIEW tbl_sum AS SELECT tbl.*, SUM(tbl.col2) OVER (PARTITION BY tbl.col1) AS col3 FROM tbl;
SELECT * FROM tbl_sum;