Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 669389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:08:46+00:00 2026-05-14T00:08:46+00:00

I understand the point of GROUP BY x . But how does GROUP BY

  • 0

I understand the point of GROUP BY x.

But how does GROUP BY x, y work, and what does it mean?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:08:46+00:00Added an answer on May 14, 2026 at 12:08 am

    Group By X means put all those with the same value for X in the one group.

    Group By X, Y means put all those with the same values for both X and Y in the one group.

    To illustrate using an example, let’s say we have the following table, to do with who is attending what subject at a university:

    Table: Subject_Selection
    
    +---------+----------+----------+
    | Subject | Semester | Attendee |
    +---------+----------+----------+
    | ITB001  |        1 | John     |
    | ITB001  |        1 | Bob      |
    | ITB001  |        1 | Mickey   |
    | ITB001  |        2 | Jenny    |
    | ITB001  |        2 | James    |
    | MKB114  |        1 | John     |
    | MKB114  |        1 | Erica    |
    +---------+----------+----------+
    

    When you use a group by on the subject column only; say:

    select Subject, Count(*)
    from Subject_Selection
    group by Subject
    

    You will get something like:

    +---------+-------+
    | Subject | Count |
    +---------+-------+
    | ITB001  |     5 |
    | MKB114  |     2 |
    +---------+-------+
    

    …because there are 5 entries for ITB001, and 2 for MKB114

    If we were to group by two columns:

    select Subject, Semester, Count(*)
    from Subject_Selection
    group by Subject, Semester
    

    we would get this:

    +---------+----------+-------+
    | Subject | Semester | Count |
    +---------+----------+-------+
    | ITB001  |        1 |     3 |
    | ITB001  |        2 |     2 |
    | MKB114  |        1 |     2 |
    +---------+----------+-------+
    

    This is because, when we group by two columns, it is saying "Group them so that all of those with the same Subject and Semester are in the same group, and then calculate all the aggregate functions (Count, Sum, Average, etc.) for each of those groups". In this example, this is demonstrated by the fact that, when we count them, there are three people doing ITB001 in semester 1, and two doing it in semester 2. Both of the people doing MKB114 are in semester 1, so there is no row for semester 2 (no data fits into the group "MKB114, Semester 2")

    Hopefully that makes sense.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just don't understand. It worked fine at one point but not it's not
I am trying to understand a point here in C++. If class A has
While reading this link, I did not understand the point on avoiding table locks
I understand that floating point arithmetic as performed in modern computer systems is not
I understand the regular fixed-point type combinator and I think I understand the higher-order
I read that System.Drawing.Point is a value type. I do not understand. Why?
I am trying to understand how a language interpreter works. Can you guys point
I've got a question about floating point precision. As I understand it, ULP is
This is a short question. At some point my thread understand that it should
I understand that Exceptions are for exceptional cases [a], but besides just being repeated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.