title: Catching latest column value change in SQL
body: <p>How can I get the date for the latest value change in one column with one SQL query?</p>
  
  <p>Possible database situation:</p>
  
  <pre><code>Date        State
  
  2012-11-25  state one
  2012-11-26  state one
  2012-11-27  state two
  2012-11-28  state two
  2012-11-29  state one
  2012-11-30  state one
  </code></pre>
  
  <p>So result should return 2012-11-29 as latest change state. If I group by State value, I will get the date for first time I have that state in database. </p>
  
  <p>The query will group the table on state and show the state and in the date field the latest date created of that state.</p>
  
  <p>From the given input the output would be </p>
  
  <pre><code>Date               State
  
  2012-11-30        state one
  2012-11-28        state two
  </code></pre>