title: sql server calculate value according to pecentage and add and group them according to uid
body: <p>I have this table <code>temp_calpoints1</code></p>
  
  <pre><code>orderid processid uid ordervalue percent
  1       1         16  33000      10
  1       2         4   33000      10
  1       3         5   33000      10
  1       4         5   33000      20
  1       5         4   700000     10
  2       1         4   100000     10
  2       2         4   100000     10
  2       3         5   100000     10
  2       4         4   100000     20
  2       5         4   700000     10
  2       6         1   700000     6
  2       6         4   700000     6
  2       6        16   700000     6
  4       5         5   700000     10
  5       1        16   700000     10  
  </code></pre>
  
  <p>I want to get the output </p>
  
  <p>percentage value of ordervalue 
  for eg in 1st record     10/100*33000=3300</p>
  
  <p>I need to add all these values and group them acccording to uid</p>
  
  <pre><code>  uid  totalvalue
       1     xxx
       4     xxx
       5     xxx
       16    xxx
  </code></pre>
  
  <p>I tried this but some how its not working</p>
  
  <pre><code>SELECT
    processid,
    SUM(ordervalue) AS [TotalSales]
  FROM [dbo].temp_calpoints1
  GROUP BY [uid]
  </code></pre>