title: SQL count based on two columns
body: <p>I have a training record table for staff (TRAINREC)</p>
  
  <p>In this table it contains their employ_ref and the Course_Ref.</p>
  
  <p>I need to count how many people have done all 5 available courses, how many have done 4, 3,2,1 and 0</p>
  
  <p>It could be the case where they have done the same course more than once and so would have multiple entries for the same course in this table but it should still only count as one.</p>
  
  <p>What would be the best method to count the entries (SQL Server) and count how many people have done "x" number of courses.</p>