473,503 Members | 1,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"Group by" annually

How can I use "Group By" or a formula to group my query results in
1-year periods from a given date, e.g. 3 groups:
1 Sept 2001 - 1 Sept 2002
1 Sept 2002 - 1 Sept 2003
1 Sept 2003 - 1 Sept 2004

Thanks,

Mark

Nov 13 '05 #1
2 1661
In the Field row of your query, enter:
FinYear: Year(DateAdd("m", -8, [DateField]))
replacing "DateField" with the name of your date field.
This returns 2001 for all dates between 1 Sep 2001 and 31 Aug 2002.

You can now Group By this calculated field.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"mark" <ma****************@bloglines.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
How can I use "Group By" or a formula to group my query results in
1-year periods from a given date, e.g. 3 groups:
1 Sept 2001 - 1 Sept 2002
1 Sept 2002 - 1 Sept 2003
1 Sept 2003 - 1 Sept 2004

Thanks,

Mark

Nov 13 '05 #2
Thanks, Allen. For those others who might want to know, I added one
enhancement & here's what I ended up with:
Year(DateAdd("m",(-1)*DatePart("m",[DateField]),[DateField]))

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
17069
by: Tamer Higazi | last post by:
Hi! I have problems creating joins between tables and to limit rows for a specified clolumn. I have 2 tables! employees departments I face the problems with the GROUP BY clause and i don't...
0
450
by: Lilian BRUN | last post by:
I have a table State_history : Id State DateModif object_id 1 A 10/10/01 1 2 B 10/11/01 1 3 B 11/11/01 1 4 B 11/12/01 1 5 C ...
0
1232
by: TaeHo Yoo | last post by:
After running my code, group tree(the left section of the report) changes but not the content in the report. My code is ---------------------------------------------------------- Private Sub...
4
1321
by: Phill W. | last post by:
Is there anything amiss with the newsgroup microsoft.public.dotnet.vb.general ?? From where I'm sitting, it's /completely/ dried up - only four posts in as many days. Did I miss the mass...
5
1983
by: Dave Smithz | last post by:
Hi there, Been working on an evolving DB program for a while now. Suddenly I have come across a situation where I need to update a table based on a group by query. For example, I have a table...
1
1654
by: ASF | last post by:
Is it possible to create a crystal report graph in which a user selects some parameters---a date range for instance--- AND the table field that they wish to "Group By" then hits the submit button...
1
1718
by: Thomas Qi | last post by:
There is a basic sql below: SELECT CTEnr AS ID, TimeStamp, DatagramSize, Source AS LocalIP, Destination AS RemoteIP, Protocol, Messages, SourcePort AS LocalPort, DestPort AS RemotePort FROM...
2
2595
by: nico3334 | last post by:
Hi, I have a SQL table that has data like this: Title Month Info 1 ---- 7 ---- 100 1 ---- 7 ---- 100 1 ---- 8 ...
2
9811
by: BrightFuture | last post by:
I'm fairly new to detailed data analysis. A lot of my queries end up using the Group By function, but other than knowing when to use it, I don't understand how it works. All I'm doing is hitting...
0
7203
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7463
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5017
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
738
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
389
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.