title: Select min from a given range
body: <p>I have the following data:</p>
  <pre><code> req_id |      detected
  ------------------------
      420 |       26808302
      420 |       26808303
      420 |       26808305
      420 |       26808306
      422 |       26808302
      425 |       26808303
      422 |       26808305
      425 |       26808306
      420 |       26808365
      420 |       26808366
  
  </code></pre>
  <p>... And i would need to group these records based on their id, selecting just the min values for a given range of 'detected' (+- 20 for example).
  This is what i'd be expecting:</p>
  <pre><code>req_id |      detected
  ------------------------
      420 |       26808302
      422 |       26808302
      425 |       26808303
      420 |       26808365
  </code></pre>
  <p>Is there a way with SQL think of a way to do this, or am i losing my time with this data?</p>