select count(*) from (select DISTINCT magackid from graph_tbl where magaid =142 group by magackid
)a

解决方案 »

  1.   

    select count(DISTINCT magackid) from graph_tbl where magaid =142 
    group by magackid
    select count(DISTINCT magackid) from graph_tbl where magaid =142 
    --group by magackid 可以不要。
      

  2.   

    select DISTINCT magackid,count(magackid) from graph_tbl where magaid =142 group by magackid
      

  3.   

    写错了,txlicenhe(马可) 对的
      

  4.   

    select count(DISTINCT magackid) as 记录数 from graph_tbl where magaid =142--不用Group by
      

  5.   

    select count(DISTINCT magackid) from graph_tbl where magaid =142 
    group by magackid
      

  6.   

    declare @cont int
    select @cont=count(*) from (select DISTINCT magackid from graph_tbl where magaid =142 group by magackid
     )  bselect @cont 
    print @cont
      

  7.   

    同意 txlicenhe(马可)  兄弟的!
    up
      

  8.   

    同意 txlicenhe(马可)  兄弟的!
      

  9.   

    同意 txlicenhe(马可)  兄弟的!