开发者

Is it possible to count the amount of letters in the alphabet that exists in mysql column?

I would like to get a count of first letters in a column.

Example:

My column has names like alice, jacob, james, britney and so on. I would like to count the amount of letters in the alphabet that exists. In the above it wo开发者_开发技巧uld be 3 even though the letter "j" is repeated.

Thanks for any help.


Try

SELECT COUNT(DISTINCT SUBSTRING(`name`, 1, 1)) FROM `users`
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜