Hi there, I have a date issue that I cant figure out what the solution is and wonder if someone can help please ? select distinct saledate, storenum, prodcode, right(dept,2),costvalue from sales inner join productmasteron (sales.prodcode = productmaster.productcode) where saledate > (getdate() - datepart(dw, getdate())) - 8 and saledate < (getdate() - datepart(dw, getdate())) - 1 order by storenum, right(dept,2)
Every week on a wednesday I run the following code for the week previous ie: If I run it on wednesday 25/07/2007 I need the above selected records for and including the saledate between the 15/07/2007 (Sunday) to the 21/07/2007 (Saturday)What I would like is for me to run the above code on any day this week and get the same saledate between dates ie if i run this on any day between 23/07/2007 and the 27/07/2007 I will still get the query returning sales back for 15/07/2007 (Sunday) to the 21/07/2007 (Saturday).Please advise how I could change my saledate information in the above where clause to allow for this.