title: How to get the row with max timestamp in postgres?
body: <p>I need to get a row of information with max timestamp in postgresql. Below is a demo for this question:</p>
  
  <pre><code>drop table Mytable cascade
  create table MyTable (usr char(1), event_dt timestamp without time zone);
  insert into mytable values ('A','01-JAN-2009 11:10:11');
  insert into mytable values ('A','02-JAN-2009 11:10:22');
  insert into mytable values ('B','02-JAN-2009 01:01:59' );
  insert into mytable values ('C', '31-DEC-2008 02:02:02');
  insert into mytable values ('D', '31-DEC-2008 03:03:03');
  </code></pre>
  
  <p>If I do </p>
  
  <pre><code>select max(event_dt) from (
  select usr,event_dt from mytable where usr= 'A') as foo 
  </code></pre>
  
  <p>It is sort of what I need but it only returns the event_dt 
  "2009-01-02 11:10:22"</p>
  
  <p>Where I want the usr as well sa event_dt from that row. How do I do it?</p>