with sums as (
 select col1,sum(col2) sumcol2
 from tbl
 group by col1
)
select a.*,b.sumcol2
from tbl a 
  inner join sums b
  on a.col1=b.col1

Comments

Popular posts from this blog