title: How to group 24-hour data in 30 minutes interval to get the count?
body: <p>I have a field name <code>timestamp</code> in the sales table in which the data format is: 20210725.1800 which means 2021-year 07-month 25th-date 00:30:00 AM.</p>
  <p>Now, if I want to count the sales on between 30 minutes intervals from 20210725.0000 to 20210725.1800, I can do that by simply writing:</p>
  <pre><code>def var k as int no-undo.
  
  for each sales no-lock 
     where salesdate =  07/25/2021 
     and   timestamp &gt;= 20210725.0000
     and   timestamp &lt;= 20210725.1800
  :
  
     if available sales then do:
  
        k = k + 1.
        pause 0.
  
        display k with frame f.
  
     end.
  
  end.
  </code></pre>
  <p>But, I don't want to run the same query 24 times by changing the start and end time of the <code>timestamp</code> field.</p>
  <p>So, I am looking for a smarter way to find out the whole day sales count grouped by 30 minutes intervals on this timestamp field.</p>