一个存储过程的统计代码怎么写?

来源:百度知道 编辑:UC知道 时间:2024/05/27 00:32:52
表“AAA”里的字段有A1,A2,A3。 A1是用户名。但是A1的字段是可以重复的。我现在要在存储过程里统计不一样的用户名有多少。请问该怎么写呢?

select distinct count(*)from 表名
distinct 去除重复值;
count(*) 统计记录数

这还用什么存储过程,1个sql就搞定了

select count(distinct A1) as 姓名数 from 表名

create view abc
as
select count(distinct(sname))as '不一样' from student