0

我想获得两列(均为 TT_TIMESTAMP(26,6))之间的差异,select timestamp1 - timestamp2 as diff from table;但出现此错误:An interval data type must be specified for a datetime arithmetic result

有任何想法吗?

4

1 回答 1

0

In T-SQL you would need to provide an internal type (year,month,day ect) that would identify the specific element that you are wanting to se the differance in.

A formula like the following should give you the differance in days for example in T-SQL:

DATEDIFF(day, timestamp1, timestamp2) AS DateDiff

W3 Schools has a good indicator of the various options you can use

于 2022-01-27T15:36:12.423 回答