Hi,
I have a query that need to be run every month. The time range in the query is from today’s date go back 24 month. For example, if I run it on 11/01/2012, then it will look like this.
d.timestamp >= {ts '2010-11-01 00:00:01'} AND d.timestamp <{ts '2012-11-01 00:00:01'})
Now I have to manually change it every time I run it. I am wondering if I can set it up in the query. I can use GETDATE()to replace {ts '2012-11-01 00:00:01'}, but how can I get the time back to 24 month.
Thanks a lot for any suggestions and helps!!
I have a query that need to be run every month. The time range in the query is from today’s date go back 24 month. For example, if I run it on 11/01/2012, then it will look like this.
d.timestamp >= {ts '2010-11-01 00:00:01'} AND d.timestamp <{ts '2012-11-01 00:00:01'})
Now I have to manually change it every time I run it. I am wondering if I can set it up in the query. I can use GETDATE()to replace {ts '2012-11-01 00:00:01'}, but how can I get the time back to 24 month.
Thanks a lot for any suggestions and helps!!