【已解决】doris中获取两个时间点中间的日期

Viewed 62

image.png

请问有类似这种效果的函数吗?

1 Answers

可以通过sequence函数实现,文档地址 👈


mysql> select sequence(cast('2019-05-15 12:00:00' as datetimev2(0)), cast('2022-05-17 12:00:00' as datetimev2(0)), interval 2 year) as sequence_2_year;
+------------------------------------------------+
| sequence_2_year                                |
+------------------------------------------------+
| ["2019-05-15 12:00:00", "2021-05-15 12:00:00"] |
+------------------------------------------------+