how to count rows by first letter?

前端 未结 3 543
暗喜
暗喜 2021-01-14 17:21

a noob question here!

I wrote this query, but the \"group by\" is very stupid... so, how can I correct this?

SELECT
    COUNT(*) AS total,
    \'x\'         


        
3条回答
  •  耶瑟儿~
    2021-01-14 17:57

    should give you everything in case you want it

    SELECT
      COUNT(*) AS total,
      test
    FROM
     (SELECT substring(name,1,1) as test
     from contents) t
    GROUP BY test
    

提交回复
热议问题