title: How to find the distinct records when a value was changed in a table with daily snap shots
body: <p>I have a table that has a SNAP_EFF_DT (date the record was inserted into the table) field. All records are inserted on a daily basis to record any changes a specific record may have. I want to pull out only the dates and values when a change took place from a previous date.</p>
  
  <p>I am using Teradata SQL Assistant to query this data. This is what I have so far:</p>
  
  <pre><code>SEL DISTINCT MIN(a.SNAP_EFF_DT) as SNAP_EFF_DT, CLIENT_ID, FAVORITE_COLOR
  FROM CUSTOMER_TABLE
  GROUP BY 2,3;
  </code></pre>
  
  <p>This does give me the first instance of a change to a specific color. However, if a customer first likes blue on 1/1/2019, then changes to green on 2/1/2019, and then changes back to blue on 3/1/2019 I won't get that last change in the results and will assume their current favorite color is green, when in fact it changed back to blue. I would like a code that returns all 3 changes.</p>