Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Calculate sum based on another column

$
0
0

how to calculate sum of a column values based on another column value without creating view or function in a sql server.

EX:

Col 1 Col 2   Col 3 = Col2/Sum of same value from col1
  
A      1          1/3
A      2          2/3
B      3          3/12
B      4         4/12
B      5         5/12
C      6         6/13
C      7         7/13

any suggestions?


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>