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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top