select name,sum(flag) as flag from  test group by name

解决方案 »

  1.   

    select [name],sum(flag) flag  from test group by [name]
      

  2.   

    select name,sum(flag) as flag
     from  test 
    group by name
      

  3.   

    select name,count(flag) as flag
     from  test 
    where flag=1
    group by name
      

  4.   

    select name,sum(flag)as flag
    from test
    group by name
      

  5.   

    select name,sum(flag) as flag from  test group by name
      

  6.   

    select name,sum(flag) as flag from  test group by name