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 可以不要。
select DISTINCT magackid,count(magackid) from graph_tbl where magaid =142 group by magackid
写错了,txlicenhe(马可) 对的
select count(DISTINCT magackid) as 记录数 from graph_tbl where magaid =142--不用Group by
select count(DISTINCT magackid) from graph_tbl where magaid =142 group by magackid
declare @cont int select @cont=count(*) from (select DISTINCT magackid from graph_tbl where magaid =142 group by magackid ) bselect @cont print @cont
group by magackid
select count(DISTINCT magackid) from graph_tbl where magaid =142
--group by magackid 可以不要。
group by magackid
select @cont=count(*) from (select DISTINCT magackid from graph_tbl where magaid =142 group by magackid
) bselect @cont
print @cont
up