Rex
asked on
My WHERE Clause Using DatePart is Not Working the Way I Need it to
I am using the following WHERE clause to attemp to pull only data from LAST WEEK from a table
WHERE DatePart("ww", [15th_St_Panel_Plant_FPY.P roductionD ate]) = (DatePart("ww", Date())-1) AND DatePart("yyyy", [15th_St_Panel_Plant_FPY.P roductionD ate]) = (DatePart("yyyy", Date()));
However, when I compare the query return to manually calculated data from Last Week, the numbers do not match.
The ProductionDate is in the format mm/dd/yyyy. The first day of the week is intended to be Sunday.
Is there something in my Syntax, or am I just wrong in trying to do it this way?
WHERE DatePart("ww", [15th_St_Panel_Plant_FPY.P
However, when I compare the query return to manually calculated data from Last Week, the numbers do not match.
The ProductionDate is in the format mm/dd/yyyy. The first day of the week is intended to be Sunday.
Is there something in my Syntax, or am I just wrong in trying to do it this way?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You may need to tweak the values of -6 and +1 to get the precise definition of "last week" that you are looking for.
Glad to help.
Glad to help.
ASKER
Thanks
ASKER