title: Query to find second largest value from every group
body: <p>I have three tables:</p>
  
  <ol>
  <li><code>project: project_id, project_name</code></li>
  <li><code>milestone: milestone_id, milestone_name</code></li>
  <li><code>project_milestone: id, project_id, milestone_id, completed_date</code></li>
  </ol>
  
  <p>I want to get the second highest completed_date and milestone_id from project_milestone grouped by project_id. That is I want to get the milestone_id of second highest completed_date for each project. What would be the correct query for this?</p>