我在DB2中有一个表,其中包含如下数据:
| 已完成时间戳|详细信息|
| - -|- -|
| 2021-12-19-15.38.10 |abcd语言|
| 2021-12-19-15.39.10 |埃夫格|
| 2021-12-19-15.48.10 |伊克尔|
| 2021-12-19-15.49.10 |主操作程序|
| 2021-12-19-15.54.10 |第一|
我希望能够每10分钟计算一次表中的行数,例如:
| 时间|计数器|
| - -|- -|
| 2021-12-19-15.40 |2个|
| 2021-12-19-15.50 |2个|
| 2021-12-19-16.00 |一个|
completed_timestamp =时间戳,详细信息= varchar
我在其他SQL语言中见过这样做,但到目前为止还不知道如何在DB2中做到这一点。
1条答案
按热度按时间4uqofj5v1#
您可以从时间戳中获取分钟,将其除以10,得到下一个整数,乘以10,然后将其作为分钟添加到小时: