title: Shortening the length of a dataset
body: <p>I have a dataset like this, goes on for many thousands of rows, what im trying to achive is  a way to shorten the dataset so in the case that the dataset contains multiple rows with the same layer sort in a row im left with the top and buttom rows. In this case what would mean something like this:</p>
  <p><a href="https://i.stack.imgur.com/nc6ux.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nc6ux.png" alt="Example of data set, with values needed to extract marked" /></a></p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>BorID</th>
  <th>Depth1</th>
  <th>Depth2</th>
  <th>Layer</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>B1(192.2215)</td>
  <td>0.1</td>
  <td>0.8</td>
  <td>S</td>
  </tr>
  <tr>
  <td>B1(192.2215)</td>
  <td>0.8</td>
  <td>2.4</td>
  <td>ML</td>
  </tr>
  <tr>
  <td>B1(192.2215)</td>
  <td>2.4</td>
  <td>3.9</td>
  <td>S</td>
  </tr>
  <tr>
  <td>B1(192.2215)</td>
  <td>3.9</td>
  <td>10.7</td>
  <td>ML</td>
  </tr>
  <tr>
  <td>B1(192.2215)</td>
  <td>10.7</td>
  <td>13.5</td>
  <td>S</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Is there any way to achive that getting the lowest value from each Deapth1 and the highest value from each Deapth2 if Layer is the same value?</p>
  <p>BorID is a unique key</p>