【发布时间】:2021-10-01 17:06:38
【问题描述】:
我在sales表中有一个字段名timestamp,其数据格式为:20210725.1800,表示2021年07月25日00:30:00 AM。
现在,如果我想计算从 20210725.0000 到 20210725.1800 之间 30 分钟间隔的销售额,我可以简单地写:
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.
但是,我不想通过更改 timestamp 字段的开始和结束时间来运行相同的查询 24 次。
因此,我正在寻找一种更智能的方法来找出此时间戳字段上按 30 分钟间隔分组的全天销售计数。
【问题讨论】:
-
你的数据格式让我很困惑。如果 0.1800 = 00:30,那么 0.9000 = 02:30 - 那么如何记录 03:00?还是应该举例 0.01800 = 00:30 ?
标签: openedge progress-4gl 4gl