There are several issues here and the most important of them all is an absolute show stopper for us and almost everyone that has posted has mentioned it in one form or another...
WE CAN'T ACTUALLY SOLVE YOUR PROBLEM UNTIL WE KNOW WHAT THE DATATYPE FOR THE PDWEDT COLUMN IS AND YOU PROVIDE AN EXAMPLE DATE FROM THAT COLUMN!
So.... any feedback on this so we can actually help or should this problem just continue to be unresolved? 😉
Your original post is also a bit confusing... You first say...
I have such an issue. I want to select a column PDWEDT (it is numeric) and I need to select previous Saturday.
... but then you display the following code...
Afterwards, I have some code and later I just try to select the dates
AND p.[PDWEDT] = @LastSunday
So, which is it??? Are you trying to match for the previous Saturday or the previous Sunday???
And, while I have your attention, if GETDATE() occurs on the day you want (again, is that Saturday or Sunday), would the "previous" date you're looking for be the date the same as GETDATE() or 7 days prior.
Heh... enquiring mind want to know. 😀