title: Sql Query Grouping and select Complete Row
body: <p>I have to write a query to select the id of employee who joined the department first for this I apply grouping on deptId and Min aggregate function on join date.</p>
  
  <pre><code>EmpId joinDate  deptId
  1      2/5/2012   2
  2      5/6/2012   1
  3      2/5/2012   2
  4      5/58/2012  2
  </code></pre>
  
  <p>My result should be:</p>
  
  <pre><code>EmpId joinDate  deptId
  1      2/5/2012   2
  2      5/6/2012   1
  </code></pre>
  
  <p>I am unable to get EmpId, my EmpId is of type Guid.  Is there any possible solution for that.  I am using MS SQL SERVER 2008.</p>