title: Select closest timestamp every 30 minutes
body: <p>Let's assume I have following timestamp data in table:</p>
  
  <pre><code>Id                   Timestamp
  -------------------- -----------------------
  1                    2016-09-19 13:17:24.000
  2576                 2016-09-19 13:47:24.000
  4945                 2016-09-19 14:17:24.000
  7538                 2016-09-19 14:47:24.000
  10016                2016-09-19 15:17:24.000
  10570                2016-09-19 15:24:51.000
  11968                2016-09-19 15:47:55.000
  11990                2016-09-19 15:48:08.000
  13648                2016-09-19 16:18:08.000
  14742                2016-09-19 16:36:55.000
  </code></pre>
  
  <p>Now I want select closest timestamp from start_date and search for next closest timestamp for found timestamp+30 min</p>
  
  <p>Short example: </p>
  
  <pre><code>start_date = 2016-09-19 13:00:00.000
  end_date = 2016-09-19 16:00:00.000
  Now it should find record:
  2016-09-19 13:17:24.000
  Now we add 30 minutes to found date, so we will search closest timestamp for 13:47:23.000 and so on until date = 16:00.
  </code></pre>
  
  <p>Note: it should be closest approximate value, so it can be less than 30 min diff</p>
  
  <p>Full Example:</p>
  
  <pre><code>start_date = 2016-09-19 13:00:00.000
  end_date = 2016-09-19 16:00:00.000
  
  Id                   Timestamp
  -------------------- -----------------------
  1                    2016-09-19 13:17:24.000
  2576                 2016-09-19 13:47:24.000
  4945                 2016-09-19 14:17:24.000
  7538                 2016-09-19 14:47:24.000
  10016                2016-09-19 15:17:24.000
  11968                2016-09-19 15:47:55.000
  </code></pre>
  
  <p>How I can achieve this? I would rather avoid using cursor, it can be done by</p>