Redshift:结合GETDATE和Interval功能

时间:2015-01-22 19:12:10

标签: intervals amazon-redshift getdate

我想只提取与今天日期相对应的结果。我是Redshift的新手,但我熟悉MYSQL。我能得到的最接近的是24小时,但我宁愿只使用今天的数据,我一直在使用:

 history_date >= date(GETDATE())- Interval '24 hours'

使用当前日期功能是另一种选择吗?这是完整的查询,以防任何人感兴趣:)

1 个答案:

答案 0 :(得分:0)

您应该可以use the DATE_TRUNC function to get the date with the time portion removed

history_date >= date(DATE_TRUNC('day', GETDATE()))