求一sql语句
表结构如下:
表名student
id(自动增长类型)  name(字符串类型)
1                张三  
2                王二
3                李四
4                张三我想通过一个sql语句查询出来学生的数量,名字相同的为一个学生,即应当查询出来学生的
数量为3个,我通过下面的sql语句语法错误,请大家指正一下
select count(distinct name) from student
我想通过这个语句等到结果是:3,但语法错误

解决方案 »

  1.   

    select count(name) from student  gorup by name
      

  2.   

    SELECT count(DISTINCT name) FROM student 
      

  3.   

    楼主的语句没错啊,是mysql吗?
      

  4.   

    select count(name) from student  gorup by name
      

  5.   

    select count(name)from student
      

  6.   

    看你是美眉,偶帮你一下吧。上面答案都错。正确如下:select count(*) from (select distinct name from student  group by name) t;
      

  7.   

    select count(*) as count from (select distinct name from student  group by name) t;这样好取结果些。把分全给我啊。