【发布时间】:2021-11-17 16:33:33
【问题描述】:
我必须编写一个 sql 查询,我需要提取 30 天减去几天的数据,
类似这样,日期时间
我可以在 teradata 中写入的最佳方式是什么?
提前致谢:)
【问题讨论】:
标签: datetime teradata case-statement teradata-sql-assistant teradatasql
我必须编写一个 sql 查询,我需要提取 30 天减去几天的数据,
类似这样,日期时间
我可以在 teradata 中写入的最佳方式是什么?
提前致谢:)
【问题讨论】:
标签: datetime teradata case-statement teradata-sql-assistant teradatasql
基于时间戳,正好是 5 天,例如2021-09-24 13:42 -> 2021-09-19 13:42
where timestamp_column <= current_timestamp - interval '5' day
从午夜开始的全天:
where timestamp_column <= current_date - 5
【讨论】:
last_day(add_months(current_date,-1))