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  

Grouping



 
 
Thread Tools Display Modes
  #1  
Old July 16th, 2008, 08:03 PM posted to microsoft.public.access.queries
Greg
external usenet poster
 
Posts: 47
Default Grouping

Hello,

A question.

If I have a table like this:

777 555 1111, 7/1/2008, 1, 333
777 555 1111, 6/1/2008, 0, 444
777 555 1111, 7/1/2008, 1, 555

I can group on telephone number (first field) and Date (second field) if
date = 7/1/2008 and sum on third and fourth field without a problem.

But can I get the number of records with the same telephone number?

For example a result that looks like:
777 555 1111(group by), 2(count date), 2 (sum field 3), 888( sum field 4),
and a new field with the result 3 representing the number of records with
the same telephone number(group by number) ??

If someone could give me a suggestion or point me in the right direction I
would appreciate it. Thank you in advance.

Greg


  #2  
Old July 16th, 2008, 09:18 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Grouping

In a separate query.

SELECT PhoneNumber, Count(PhoneNumber) as CountRecordswithThisPhone
FROM YourTable
GROUP BY PhoneNumber


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County

Greg wrote:
Hello,

A question.

If I have a table like this:

777 555 1111, 7/1/2008, 1, 333
777 555 1111, 6/1/2008, 0, 444
777 555 1111, 7/1/2008, 1, 555

I can group on telephone number (first field) and Date (second field) if
date = 7/1/2008 and sum on third and fourth field without a problem.

But can I get the number of records with the same telephone number?

For example a result that looks like:
777 555 1111(group by), 2(count date), 2 (sum field 3), 888( sum field 4),
and a new field with the result 3 representing the number of records with
the same telephone number(group by number) ??

If someone could give me a suggestion or point me in the right direction I
would appreciate it. Thank you in advance.

Greg


  #3  
Old July 17th, 2008, 03:25 AM posted to microsoft.public.access.queries
Greg
external usenet poster
 
Posts: 47
Default Grouping

John,
Thank you, I will give it a try!
Greg
"John Spencer" wrote in message
...
In a separate query.

SELECT PhoneNumber, Count(PhoneNumber) as CountRecordswithThisPhone
FROM YourTable
GROUP BY PhoneNumber


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County

Greg wrote:
Hello,

A question.

If I have a table like this:

777 555 1111, 7/1/2008, 1, 333
777 555 1111, 6/1/2008, 0, 444
777 555 1111, 7/1/2008, 1, 555

I can group on telephone number (first field) and Date (second field) if
date = 7/1/2008 and sum on third and fourth field without a problem.

But can I get the number of records with the same telephone number?

For example a result that looks like:
777 555 1111(group by), 2(count date), 2 (sum field 3), 888( sum field

4),
and a new field with the result 3 representing the number of records

with
the same telephone number(group by number) ??

If someone could give me a suggestion or point me in the right direction

I
would appreciate it. Thank you in advance.

Greg




 




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 01:59 PM.


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