Retrieving weekly totals from MSAccess

  • Thread starter Thread starter Damo_Suzuki
  • Start date Start date
D

Damo_Suzuki

I have a MS Access database with two fields : entrydate(Date/Time) and
amount (Number). I need to retrieve weekly totals of the amount column.
Can this be done with a pure SQL query and if so what would it look
like?
Any help would be much appreciated.
 
SELECT DatePart("ww",MyTable.entrydate) AS ThisWeek, Sum(MyTable.Amount) AS
WeeklyAmount
FROM MyTable
WHERE (((MyTable.entrydate) Is Not Null))
GROUP BY DatePart("ww",MyTable.entrydate);

This uses the DatePart function to determine the week the date is in. To be
sure you are getting the date groupings you want, look in VBA Help for
particulars on the DatePart function. It then groups on this week number and
sums the Amount.
 
Back
Top