title: Left join with multiple rows from right table in mySQL
body: <p>I have two tables (<code>agents</code>, <code>visits</code>). </p>
  
  <p>Agents can have many visits each with its timestamp</p>
  
  <p>I want to select all agents using <code>left join</code> without agent duplicates and if the agent has many visits then show the most recent one i.e select the last timestamp in visits table.</p>
  
  <p>I tried the following query </p>
  
  <pre><code>SELECT * 
    FROM agents 
    LEFT 
    JOIN  visits 
      ON agent_id = visit_id 
   GROUP 
      BY agent_id
  </code></pre>
  
  <p>This works well without agent duplicates but shows the oldest visit and I want to show the last one (the most recent timestamp in the second table <code>visits</code>).</p>