select...count()

declare @t table( c varchar(10));

insert @t
select *
from
(
 select 'A' as c union all
 select 'B' union all
 select 'B' union all
 select null union all
 select null
) t;

select count(*) from @t;
select count(c) from @t;
select count(distinct c) from @t;
select distinct c from @t;

测一下上面最后四条语句的执行结果: 

Code

 

 

posted on 2009-03-04 11:23  Good life  阅读(216)  评论(0编辑  收藏  举报