[AccessD] Max Date of Week

Gustav Brock Gustav at cactus.dk
Tue Feb 27 13:15:11 CST 2007


Hi Mark

For Monday as the first day of a week, it could be:

  SELECT
    Max([DateField]) As DateMax,
    DatePart("ww", [DateField], 2, 2) As WeekNo
  FROM
    tblYourTable
  GROUP BY
    DatePart("ww", [DateField], 2, 2)

If this is for critical use and you need the correct ISO 8601:1988 weeknumber for week 53 as well, you should use the function for this I've posted many times:
ISO_WeekNumber

/gustav
    

>>> markamatte at hotmail.com 27-02-2007 19:13:57 >>>
Hello All,

I can't seem to get the SQL for this...I have a date field...I need to group 
by week, but display the greatest date value in that week.

Any ideas?

Thanks,

Mark A. Matte





More information about the AccessD mailing list