I need to run a job twice a week to gather users that have joined since the previous run date?
I want to run the job every Tuesday morning at 3:00am and every Friday at 3:00am.
on TblAnswers with the datetime field being Ans_AnsweredTime
I want to run the job every Tuesday morning at 3:00am and every Friday at 3:00am.
on TblAnswers with the datetime field being Ans_AnsweredTime
Code:
So I need to run:
Friday 05/04/2001 and collect all users since Tuesday 05/01/2001
Tuesday 05/11/2001 and collect all users since Friday 05/04/2001
Friday 05/11/2001 and collect all users since Tuesday 05/11/2001
etc.[\code]
SELECT *
FROM TblAnswers
WHERE Ans_AnsweredTime BETWEEN DateAdd(dd, -4,GetDate()) and GetDate();
I think will give me the user for every four(4) days, but will then have to manually edit the report.
Is there anyway to set up a [COLOR=blue]LastDateRun[/color] variable, so I can say something like:
SELECT *
FROM TblAnswers
WHERE Ans_AnsweredTime BETWEEN [COLOR=blue]LastDateRun[/color] and GetDate();