title: Update based on order
body: <p>Is it possible to update data based on priority defined in column.
  I have input data like this</p>
  
  <pre><code>id  Start_date   active_flag
  1   21-03-2013   N
  1   23-03-2013   N
  1   22-02-2013   N
  1   20-02-2013   N
  </code></pre>
  
  <p>we have to maintain SC2 in our data and have to keep the data for latest date ( i,e 23-02-2013 here) as active in our database.
  we will be getting files daily but in some case, we can get files with combined data for 2 days. now I have to make sure all the history is maintained and data with the latest date as active.</p>
  
  <p>My target data will look like</p>
  
  <pre><code>id  Start_date  active_flag 
  1   21-03-2013  N
  1   23-03-2013  Y
  1   22-02-2013  N
  1   20-02-2013  N
  </code></pre>
  
  <p>but how to write an update which can update data for the column id , based on the order of Start_date.</p>
  
  <p>Thanks in advance</p>