title: Select Statement to Retrieve Smoothed Timestamps
body: <p>I need to select data from this table [dbo].[table] in SQL Server below. However, I need to select intervals of 30 minutes. I cannot use WITH statements because Tibco Spotfire is rejecting all With Statements for unknown reasons.</p>
  <pre><code>ID DateTime         Value
  -----------------------------
  ID1 2022-04-30 03:57:30 100    
  ID1 2022-04-30 04:02:30 110
  ID1 2022-04-30 04:07:30 120
  ID1 2022-04-30 04:12:34 130
  ID1 2022-04-30 04:17:34 140
  ID1 2022-04-30 04:22:33 150
  ID1 2022-04-30 04:27:33 160
  ID1 2022-04-30 04:32:30 170
  </code></pre>
  <p>Is there a way to retrieve the desired dataframe, so the timestamps have 30 minute intervals? I'm not too concerned on if <code>value</code> is averaged between two timestamps or not (i.e. averaging the first two records would be 105).</p>
  <pre><code>ID DateTime         Value
  -----------------------------
  ID1 2022-04-30 04:00:00 105    
  ID1 2022-04-30 04:30:00 165
  </code></pre>
  <p><strong>OR</strong></p>
  <pre><code>ID DateTime         Value
  -----------------------------
  ID1 2022-04-30 03:00:00 100    
  ID1 2022-04-30 04:30:00 170
  </code></pre>