我想得到一个字段里以各个字母开头的数目,比如以A字母开头的数据行有200条,
格式是这样的,
count    word
200      A
340           Bselect count(id) from table where word like "A%";
但这样写只能得到以A开头的数据,我想一个查询得到A-Z的所有数据。

解决方案 »

  1.   

    select count(id) from table where word like "[A-Za-z]%"; 
      

  2.   

    select left(word, 1) as Cap, count(*) from table group by Cap
      

  3.   

    select count(id) from table where
    ASCII(UCASE(SUBSTRING(word,1,1))) between 65 and 90
      

  4.   

    上述代码是A-Z的总数
    是每一个字母?
    select left(keyword,1) ,count(*) from tt group by left(keyword,1)
      

  5.   

    Guizhi 写的 select left(word, 1) as Cap, count(*) from table group by Cap 正是我所想要的,谢谢,
      

  6.   

    同时也谢谢wwwwb的热心帮助。