Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I group data per month or week in a query

Status
Not open for further replies.

Eichel

Technical User
Jun 7, 2001
1
GB
Hello!

I have following question:
using SQL or any other way in Ms Access95 is it possible to group or order data from a table, weekly or monthly? And sum for each group (using another table or a query).
for example:
the table used is sorted descending like that:

02/01/2000 1
11/01/2000 0
13/01/2000 0
13/01/2000 1
14/01/2000 1
20/01/2000 0
29/01/2000 1
.
.
.

I hope this won't get too complicated, but I would appreciate any help anyone has to offer.
thank you indeed,

Axel
 
Select Month(DateCol) As Mnth, sum(DataCol) As Tot
From table Group By month(DateCol)

If you have multiple years on the table you can use something like the next query.

Select format(DateCol, "yyyy/mm") As Mnth, sum(DataCol) As Tot
From table Group By format(DateCol, "yyyy/mm") Terry
------------------------------------
Experience is the hardest kind of teacher. It gives you the test first, and the lesson afterward.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top