最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Amazon

运维笔记admin6浏览0评论

Amazon

Amazon

Amazon-Redshift:如何获得一周前的条目(Amazon-Redshift: How to get entries that are a week old)

我正在尝试编写一个Amazon Redshift bash脚本,每周一次,将向我发送上周创建的所有用户的电子邮件。 我已经写出了其余的查询,但我无法弄清楚如何添加WHERE子句条件,就像MYSQL DATE_SUB()一样。 例:

Select *from users uwhere u.timestamp > DATE_SUB(NOW(), INTERVAL 1 WEEK)

注意:我不想每周手动输入日期,我希望只是一个快速命令,可以作为解决此问题的方法。

谢谢!

I am trying to write an Amazon Redshift bash script, that once a week, will email me all of the users created in the last week. I have the rest of the query written out, but I cannot figure out how to add a WHERE clause conditional that works like the MYSQL DATE_SUB(). Example:

Select *from users uwhere u.timestamp > DATE_SUB(NOW(), INTERVAL 1 WEEK)

Note: I do not want to manually enter the date every week, I am hoping for just a quick command that can work as a solution to this issue.

Thank you!

最满意答案

我认为这会起作用::

where u.timestamp > dateadd(day, -7, current_date)

I think this will work::

where u.timestamp > dateadd(day, -7, current_date)

发布评论

评论列表(0)

  1. 暂无评论