title: Merge lines over timespan in SCD2 table
body: <p>I'm having the following table sourced from a SCD2 table. From this source table, I have selected only a few columns, which reults in several lines looking exactly similar. I want to remove the unnecessary lines, those that contain the same data, and have the ValidFrom column showing the first value and ValidTo column showing the last value within &quot;the timespan group&quot;.</p>
  <p>Source data:</p>
  <pre><code>| Item     | Color      | ValidFrom     | ValidTo    |
  | -------- | ---------- | ------------- | ---------- |
  | Ball     | Red        | 2020-01-01    | 2020-03-24 |
  | Ball     | Blue       | 2020-03-25    | 2020-04-12 |
  | Ball     | Blue       | 2020-04-13    | 2020-05-07 |
  | Ball     | Blue       | 2020-05-08    | 2020-11-14 |
  | Ball     | Red        | 2020-11-15    | 9999-12-31 |
  | Doll     | Yellow     | 2020-01-01    | 2020-03-24 |
  | Doll     | Green      | 2020-03-25    | 2020-04-12 |
  | Doll     | Green      | 2020-04-13    | 2020-05-07 |
  | Doll     | Green      | 2020-05-08    | 2020-11-14 |
  | Doll     | Pink       | 2020-11-15    | 9999-12-31 | 
  </code></pre>
  <p>What I want to accomplish is this:</p>
  <pre><code>| Item     | Color      | ValidFrom     | ValidTo    |
  | -------- | ---------- | ------------- | ---------- |
  | Ball     | Red        | 2020-01-01    | 2020-03-24 |
  | Ball     | Blue       | 2020-03-25    | 2020-11-14 |
  | Ball     | Red        | 2020-11-15    | 9999-12-31 |
  | Doll     | Yellow     | 2020-01-01    | 2020-03-24 |
  | Doll     | Green      | 2020-03-25    | 2020-11-14 |
  | Doll     | Pink       | 2020-11-15    | 9999-12-31 | 
  </code></pre>
  <p>Note that the Item Ball at first has the color Red, then Blue and then goes back to Red. That makes things a bit more complicated, from what I have learned.</p>
  <p>Thanks for your help.</p>