How to get sums of groups of items in a table?

How do I get a count on the sum of the number of different GroupId's in the table below. The table is just an example.
So for the sample table below the query would produce values of 3,2,1
Because there a 3 records with GroupID of 1, two with GroupId of 2, and 1 for GroupID of 3
Table Name is "Teams"
GroupID        Name
1                     James
1                     Terry
1                     Monica
2                     Marcia
2                     Cramlin
3                      Troy

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey Dake Senior Director of TechnologyCommented:
This should do what you want.  The group by is what makes the query sum up revolving around the group_id.  Keep in mind any time you do a group by, the column you group on has to be one of the columns you select in the query.

select(count(*)), group_id from Teams group by group_id

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
awking00Information Technology SpecialistCommented:
select group_id, count(name)
from teams
group by group_id
order by group_id;
awking00Information Technology SpecialistCommented:
Sorry, Jeffrey. I didn't refresh my screen before I posted.
brgdotnetcontractorAuthor Commented:
Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.