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 the sum key. All of my fields then show the Group By listed, so I can't figure out why it works the way I need it to. Can someone please explain this function to me? Just in case you need to know, I'm using Access 2000. I realize that knowing that it is working is a good thing, but it sure would be nice to know why. Thanks for some assistance.
Kelly
2 9759
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 the sum key. All of my fields then show the Group By listed, so I can't figure out why it works the way I need it to. Can someone please explain this function to me? Just in case you need to know, I'm using Access 2000. I realize that knowing that it is working is a good thing, but it sure would be nice to know why. Thanks for some assistance.
Kelly
Hi
Using GROUP BY on ALL fields is a waste of time. It does eliminate duplicate records, but this can be done with normal query and the DISTINCT operater (or DISTINCT ROW ?).
You should use GROUP BY when you want to use an aggregate function ie. Sum(), Ave() Count() etc. The fields used to group on will determine which records are aggregated (summed, averaged, counted etc.).
Does that shed any light ?
MTB
As Mike says ...
Essentially you only use group by on aggregate functions like sum(), count(), etc.
In the following query ... -
SELECT MemberID, Sum(Fees)
-
FROM tblMembers
-
GROUP BY MemberID;
-
You are basically saying that you would like to know the total fees paid by each member. By grouping the MemberID field you are simply saying get the sum (total) of the fees paid by each member.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ian justice |
last post by:
Before i post actual code, as i need a speedyish reply.
Can i first ask if anyone knows off the top of their head, if there is
a likely obvious cause to the following problem.
For the moment i've...
|
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...
|
by: mark |
last post by:
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
...
|
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...
|
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...
|
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...
|
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...
|
by: wizofaus |
last post by:
I have a chunk of code which is essentially
IDbCommand cmd = db.CreateCommand();
cmd.CommandText = "SELECT X, Y, Count(*) FROM Foo WHERE Z = 1 GROUP BY
X, Y";
using (IDataReader reader =...
|
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 ...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |