title: SQL query to find most active users by how many questions answered
body: <p>I have a score table that holds all questions answered on the site but it doesn't have the user_id who answered it. The score table has an attempt_id field which is a foreign key in a processed questions table that does have the user_id. So I want to join the tables with attempt_id and have a query which will select user_id and the count of questions answered by them and limit the top five users. The selected answer holds null if the question was loaded but not answered so for the query I am looking for the selected answer should not be null also.</p>
  
  <p>Score Table
  score_id <strong>attempt_id</strong> correct_answer selected_answer ...</p>
  
  <p>Processed Questions Table
  <strong>attempt_id</strong> user_id question_id</p>
  
  <p><strong>Edit:</strong> (Copied from OP's comment below:)</p>
  
  <p>I can get the count of questions answered by a specific user using.</p>
  
  <pre><code>SELECT count(*)
  from score a
     join ProcessedQuestion b on a.attempt_id = b.attempt_id
  where user_id = [userID here] 
    and a.selected_answer is not null
  </code></pre>
  
  <p>but I have difficulty with doing it for multiple users </p>