用sysobjects表做示例,简单的演示下:
1、去掉重复的数据,统计count数量
select count(distinct(xtype)) from sysobjects
2、查询前100条,并且去掉重复数据
select distinct top 100 xtype from sysobjects
同上
select count(distinct(sysstat)) from sysobjects
select distinct top 10 sysstat from sysobjects
select distinct top (select count(distinct(sysstat)) from sysobjects) sysstat from sysobjects