Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 WHERE query + DATEADD to retrieve data from spec. month

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-11-15 : 10:01:08
Bart writes "How should one formulate a WHERE query that retrieves sales (I want to schedule this as a DTS package) every month, for the whole month. E.g. Today is 12th of November 2001. I need to retrieve sales between 1st and 31st of October 2001 but I do not want to change the where query every month.
When I query WHERE dbo.sales.date > DATEADD(Month, -1, GETDATE()) I get only like 30 days back up to now, but I dont need the sales for November and I need to include the first bit of October.
BETWEEN is not an option either since one needs to change the query params all the time.
Please ... anybody ... i am getting kind of desperate with this.
I am using this query in a DTS package (SQL to text file).
Bart Schepers
bschepers@bimg.nl"
   

- Advertisement -