title: Average of grouped rows in Sql Server
body: <p>I have an Sql Server Table.. it's something like this:</p>
  
  <pre>
  Id ...... Column1 ...... Column2  
  ````````````````````````````````  
  1 ........ 1 ............. 34  
  2 ........ 1 ............. 44  
  3 ........ 2 ............. 45  
  4 ........ 2 ............. 36  
  5 ........ 2 ............. 23  
  6 ........ 3 ............. 68  
  7 ........ 3 ............. 26  
  </pre>
  
  <p>So, I need to select the average of Column2,but group with column1 before doing that.<br>
  I mean, if I say Avg(Column2) it just returns a single row with the average of all rows.  </p>
  
  <p>What I need is, first i need to group them by column so:<br>
  Average of column2 where column1 = 1<br>
  Average of column2 where column1 = 2<br>
  Average of column2 where column1 = 3  </p>
  
  <p>So I want 3 rows returned with the averages of respective values of column1. I am lost at doing this, any hints / help please?  </p>
  
  <p>ps: I tried several related questions, and none of them helped / I couldn't understand.</p>