Hi everybody,
I'd like to create a report for each week. I have date field in my table and I try the following select:
SELECT WEEK(Rtv_Head.RtvDate) as nWeek, MIN(Rtv_Head.RtvDate) as dWeek_Start, ;
SUM(Qty*Price) AS Ret_Total ... from ... group by 1
However, my dWeek_Start doesn't seem to be correct. I would expect it to be
1/1/2006
1/8/2006
etc., e.g. each Sunday (assuming my week starts on Sunday).
I see the following dates instead:
01/03/2006
01/09/2006
01/16/2006
01/23/2006
01/30/2006
02/06/2006
02/13/2006
02/21/2006
As you see, the date could differ in 6 or 8 days instead of 7 always.
I'm not sure what is wrong with my select statement.
Thanks in advance.
If it's not broken, fix it until it is.
My Blog