title: SQL aggregate using DISTINCT on ID by latest date
body: <p><strong>Request</strong>
  I have a section of data below and my goal is to limit the agent column to be distinct only containing unique values, where the unique value selected is the latest date it was modified.</p>
  
  <p><strong>Existing Data</strong></p>
  
  <pre><code>modified     agent  rank 
  2016-10-18  346502  0   
  2013-06-04  346502  41  
  2011-10-31  346503  0   
  2012-08-13  346505  0   
  2016-04-18  346506  66  
  2015-01-27  346506  1   
  2016-01-21  346507  103 
  2015-01-27  346507  130 
  2012-01-30  346508  0   
  </code></pre>
  
  <p>Trying to use this answer <a href="https://stackoverflow.com/a/29912858/461887">https://stackoverflow.com/a/29912858/461887</a> as a basis but cannot get where to aggregate it properly.</p>
  
  <p><strong>SQL not working</strong></p>
  
  <pre><code>SELECT DISTINCT
    FLiex.agtprof.modify_date_time
    ,FLiex.agtprof.agent_id
    ,FLiex.agtprof.rank
    ,FLiex.agtprof.external_id
  WHERE
      FLiex.agtprof.modify_date_time = MAX( FLiex.agtprof.modify_date_time)
  FROM
    FLiex.agtprof
  </code></pre>
  
  <p><strong>Desired Output</strong></p>
  
  <pre><code>modify  agent   rank
  18/10/2016  346502  0
  18/04/2016  346506  66
  21/01/2016  346507  103
  13/08/2012  346505  0
  30/01/2012  346508  0
  31/10/2011  346503  0
  </code></pre>