Mitch,
 
    You are absolutely right! On seeing your post, I was about to suggest to Marc (the original poster), to adopt yours as the preferred solution. Interestingly, nothing further has been heard from Marc.
 
    Incidentally, by omitting the optional arguments, the function could be used in an even simpler form i.e.  DatePart("ww",[DateField]).
 
    My sincere thanks.
 
Best wishes,
A.D.Tejpal
 
----- Original Message -----
Sent: Wednesday, August 31, 2005 00:04
Subject: [AccessDevelopers] Re: Group by week

Out of curiousity,

Why use a function with additional overhead when
DatePart("ww",[DateField],1,1) will do?

Just trying to understand,
Mitch

--- In AccessDevelopers@yahoogroups.com, "A.D.Tejpal" <[EMAIL PROTECTED]...>
wrote:

> marc,
>
>     Assuming you have a date type field, DateDiff() function
applied with reference to first of the year, should get you week of the year.
>
>     Sample query grouping the sales on weekly basis is give below. In table T_Data, fields named SDate and Qty represent date of sale and quantity sold respectively. (first week starts on first of the year).
>
> Best wishes,
> A.D.Tejpal
>
> ===================================
> SELECT DateDiff("ww",DateSerial(Year([SDate]),1,1),([SDate]+1)) AS
SaleWeek, Sum(T_Data.Qty) AS SoldInWeek 
> FROM T_Data 
> GROUP BY DateDiff("ww",DateSerial(Year([SDate]),1,1),([SDate]+1));
> ===================================
>
>   ----- Original Message -----
>   From: [EMAIL PROTECTED]...
>   To: AccessDevelopers@yahoogroups.com
>   Sent: Tuesday, August 30, 2005 03:59
>   Subject: [AccessDevelopers] Group by week
>
>   I have a query that displays data that I would like to group by
week. I don't even really care how the week is defined as long as it is constant. ie, sun- sat, mon - sun.
>
>   I am not really that familiar with the date functions and did
not see one that seemed to help.
>
>   thanks.
>
>   marc



Please zip all files prior to uploading to Files section.




YAHOO! GROUPS LINKS




Reply via email to