select substr(col, 0, 1) as Letter, count(primary_key) as Frequency
from table
group by Letter
I don't know if you can use the alias of the columns in the group using SQLite. This will give you any first letters that are unique. Then use this as a subquery for:
select data
from table
where substr(data, 0, 1) IN (subquery)
This should work
Chris source
share