-1

我一直在对不同数据库进行一些转换,但遇到了困难。我有 3 个我正在玩的领域。我有一个日期格式的 testdate 字段。除了 testdate 我还有一个时间格式的 testtime 字段和一个整数的 testminutes。我想将这些字段连接在一起以创建时间戳,使用

我的桌子是这样建造的:

create table Testing(
Primaryid int, 
testdate date, 
testtime time,
test minutes int);

最终目标是更改表以添加两列,如下所示:

alter table testing add column begintime timestamp;
alter table testing add column endtime timestamp;

然后填充那些列开始时间

timestamp_from_parts(testdate, testtime)

这导致需要将 testminutes 添加到此 begintime 字段以查找 endtime 的问题。

timestamp_from_parts(testdate, testtime + --some conversion to turn testminutes into time--)

主要目标是将 testminutes 添加到 testdate + testtime 的时间戳中

我想这样做,以便在提供日期、开始时间和持续时间时获得事件结束时间的时间戳。

有点卡在这里,非常感谢您的帮助!

4

1 回答 1

1

在 Snowflake 中,您可以这样做。

timeadd(分钟,test_minutes,timestamp_from_parts(testdate,testtime))

于 2018-05-31T16:45:53.303 回答