What I’m trying to do is select all first letters in a column and get a COUNT of how many times each letter occurs. So far I’m able to get the count of each letter but not sure how to output the letters themselves.
Query: SELECT COUNT(SUBSTRING(last_name, 1, 1)) as letter FROM users GROUP BY SUBSTRING(last_name, 1, 1);
Output:
letter
------
0
4
1
5
1
1
13
1
74
2
2
8
1
How do I get the letters next to the numbers?
This is one way: