That's exactly how it's supposed to work in standard SQL. If you group by A, then you get a record for each different value of A. If you group by B, you get a record for each different value of B. Try it with a bigger set of records and values and it should become clearer.