Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WEEK in select SQL
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
WEEK in select SQL
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01165550
Message ID:
01165550
Views:
51
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
Next
Reply
Map
View

Click here to load this message in the networking platform