A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Group By Qtr



 
 
Thread Tools Display Modes
  #1  
Old June 30th, 2008, 08:30 PM posted to microsoft.public.access.queries
acss
external usenet poster
 
Posts: 153
Default Group By Qtr

I cant figure out how to group my records by quarters or months.Is there a
special query to otain these results? My current SQL is pretty basic using
two tables as the following:

SELECT VendorInv.EnterDate, VendorInv.InvDesc, VendorInv.InvCode,
VendorInv.InvAmt
FROM Vendor INNER JOIN VendorInv ON Vendor.VendorID = VendorInv.VendorID;

The format in EnterDate field is 01/01/2008 yet i am lost on the
grouping.Can this be done?
  #2  
Old June 30th, 2008, 08:54 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Group By Qtr

It can be done readily in a Report. Sort and Group on the EnterDate field in
the report. In the properties you can choose to group by day, week, month,
and quarter.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"acss" wrote:

I cant figure out how to group my records by quarters or months.Is there a
special query to otain these results? My current SQL is pretty basic using
two tables as the following:

SELECT VendorInv.EnterDate, VendorInv.InvDesc, VendorInv.InvCode,
VendorInv.InvAmt
FROM Vendor INNER JOIN VendorInv ON Vendor.VendorID = VendorInv.VendorID;

The format in EnterDate field is 01/01/2008 yet i am lost on the
grouping.Can this be done?

  #3  
Old June 30th, 2008, 09:54 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Group By Qtr

You say the format in EnterDate field is 01/01/2008 but did not say if it was
a DateTime datatype field.
Below assumes that it is --
SELECT Format([VendorInv].[EnterDate], "yyyy q") As [Vendor QTR],
VendorInv.InvDesc, VendorInv.InvCode, Sum([VendorInv].[InvAmt] AS Amount
FROM Vendor INNER JOIN VendorInv ON Vendor.VendorID = VendorInv.VendorID;
GROUP BY Format([VendorInv].[EnterDate], "yyyy q"), VendorInv.InvDesc,
VendorInv.InvCode;

--
KARL DEWEY
Build a little - Test a little


"acss" wrote:

I cant figure out how to group my records by quarters or months.Is there a
special query to otain these results? My current SQL is pretty basic using
two tables as the following:

SELECT VendorInv.EnterDate, VendorInv.InvDesc, VendorInv.InvCode,
VendorInv.InvAmt
FROM Vendor INNER JOIN VendorInv ON Vendor.VendorID = VendorInv.VendorID;

The format in EnterDate field is 01/01/2008 yet i am lost on the
grouping.Can this be done?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:01 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.