title: SQL first date for the first occurrence of a value
body: <p>I have a table with clients and the history of their rating (low, medium, high) which gets assessed quarterly.</p>
  
  <p>Example table:</p>
  
  <pre><code>client_ID  rating  eff_from
  111  high  30.09.2018
  111  high  30.06.2018
  111  medium  31.03.2018
  111  high  31.12.2017
  111  high  30.09.2017
  111  low  30.06.2017
  222  medium  30.09.2018
  222  high  30.06.2018
  222  high  31.03.2018
  222  low  31.12.2017
  222  low  30.09.2017
  222  medium  30.06.2017
  </code></pre>
  
  <p>I would like to get the minimum eff_from date for the latest rating. From the table above, that would be 30.06.2018 for client 111 and 30.09.2018 for client 222.</p>
  
  <p>The trick is that the rating can change for example from high to medium and back to high, so grouping by client and rating and taking the minimum eff_from date doesn't work - it would result in 30.09.2017 for client 111.</p>
  
  <p>The environment is a DB2 database and the eff_from field is formatted as date.</p>
  
  <p>Any ideas? </p>