I have a field name timestamp
in the sales table in which the data format is: 20210725.1800 which means 2021-year 07-month 25th-date 00:30:00 AM.
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:
def var k as int no-undo.
for each sales no-lock
where salesdate = 07/25/2021
and timestamp >= 20210725.0000
and timestamp <= 20210725.1800
:
if available sales then do:
k = k + 1.
pause 0.
display k with frame f.
end.
end.
But, I don't want to run the same query 24 times by changing the start and end time of the timestamp
field.
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.