csshahie
asked on
Dynamic Query to pull records for the previous month
Hi
SQLServer2000 connection.Can anybody assist with the following:
A query that will automatically extract data for the previous month. I used this previously in MSAccess "Between DateSerial(Year(Date()),Mo nth(Date() )-1,1) And DateSerial(Year(Date()),Mo nth(Date() ),1)".This prevented me from using date prompts i.e I could run a macro in MSAccess with the above customised as a criteria.I am currently using a Business Intelligence tool
Thanks
SQLServer2000 connection.Can anybody assist with the following:
A query that will automatically extract data for the previous month. I used this previously in MSAccess "Between DateSerial(Year(Date()),Mo
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
csshahie:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:
Accept Answer From adathelad
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
Arbert
EE Cleanup Volunteer
I will leave the following recommendation for this question in the Cleanup topic area:
Accept Answer From adathelad
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
Arbert
EE Cleanup Volunteer
SET @dt = GETDATE() --NOW
SET @dt2 = DATEADD(MONTH,-1,@dt)
WHERE <field_name> BETWEEN @dt2 AND @dt