从Timestamp列中减去

时间:2017-02-06 20:12:41

标签: teradata

我使用以下查询从日期戳列中减去6小时 - ORDER_PLACED_TS

select  (ORDER_PLACED_TS- interval '6' hour) AS NEW_TIME, SO.ORDER_PLACED_TS,SO.* from mytable SO
sample 10;

以上查询返回了预期结果。然后,我尝试用Hour_Subtraction_column列替换6,如下所示

select  (ORDER_PLACED_TS- interval Hour_Subtraction_column hour) AS NEW_TIME, SO.ORDER_PLACED_TS,SO.* from mytable SO
sample 10;

错误 - Expected something like a string or a unicode character betweeen the 'interval' keyword and the word 'Hour_Subtraction_column'

1 个答案:

答案 0 :(得分:1)

尝试ORDER_PLACED_TS - (Hour_Subtraction_column * interval '1' hour)