Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    13

    Unanswered: Groups Dates by DayofWeek

    Hi,

    I am trying to do a stats query that will group all of the date fields in "IncidentDate" by the day of week.

    e.g.

    Sunday 5
    Monday 7 ... etc...

    I have been playing with the "dayofweek" and "datepart" function, but I am not sure how to use them in the SQL stmt for the entire week.

    I tried something like this in the Query Designer, but this gives me errors.
    I've searched the forums by no luck.

    sunday: Sum(IIf(DatePart("d",[IncidentDate]="S",1,0)))

    Any help would be appreciated...

  2. #2
    Join Date
    Jul 2004
    Location
    Southampton, UK
    Posts
    368
    Try somehting like:

    Code:
    SELECT Weekday(incidentDate) AS Week_day, Sum(myValueToSum) AS my_Total
    FROM myTable
    GROUP BY Weekday(incidentDate);
    hth
    Chris

  3. #3
    Join Date
    Feb 2004
    Posts
    13
    Howey,

    That actually worked perfectley... I just had to add a very large IIF stmt on my report to display Sun to Sat..

    Thanks..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •