title: Hive Data selecting latest value based on timestamp
body: <p>I have a table having the following columns.</p>
  
  <pre><code>C1,C2,Process TimeStamp,InsertDateTimeStamp
  p1,v1,2014-01-30 12:15:23,2013-10-01 05:34:23 
  p1,v2,2014-01-31 05:11:34,2013-12-01 06:12:31 
  p1,v3,2014-01-31 07:16:05,2012-09-01 07:45:20 
  p2,v4,2014-02-01 09:22:52,2013-12-01 06:12:31 
  p2,v5,2014-02-01 09:22:52,2012-09-01 07:45:20
  </code></pre>
  
  <p>Now, I want to fetch unique row for each primary key based on latest <code>Process TimeStamp</code>.</p>
  
  <p>If <code>Process TimeStamp</code> is same then row having latest <code>InsertDateTimeStamp</code> should be chosen.</p>
  
  <p>So, my result should be.</p>
  
  <pre><code>p1,v3,2014-01-31 07:16:05,2012-09-01 07:45:20 
  p2,v4,2014-02-01 09:22:52,2013-12-01 06:12:31
  </code></pre>
  
  <p>How to achieve this via HiveQL ?</p>
  
  <p>I am currently using hive 0.10. I can not use subquery with IN or EXISTS.</p>
  
  <p>Thanks.</p>