There is a column that can have several values. I want to select a count of how many times each distinct value occurs in the entire set. I feel like there’s probably an obvious solution but it’s eluding me. I’ll show input & expected output, hopefully it’s obvious enough that you’ll understand.
This is example data:
|-------|
| class |
|-------|
| 5 |
| 5 |
| 12 |
| 4 |
| 12 |
|-------|
This is the output I’m trying to get:
|-------|-------|
| class | count |
|-------|-------|
| 5 | 2 |
| 12 | 2 |
| 4 | 1 |
|-------|-------|
1 Answer