select name,count(1) from StudentTbl group by name having count(1)>1
create table StudentTbl(StudentNo int, Name varchar(10)) insert into StudentTbl select 1 , '张三' insert into StudentTbl select 2 ,'张三' insert into StudentTbl select 3 ,'旺旺' insert into StudentTbl select 4 ,'月亮'select name,count(*) as 出现次数 from StudentTbl group by name having count(*)>1 drop table StudentTbl ------------------------ name 出现次数张三 2还有什么问题欢迎帖出来~
group by name
having count(1)>1
insert into StudentTbl select 1 , '张三'
insert into StudentTbl select 2 ,'张三'
insert into StudentTbl select 3 ,'旺旺'
insert into StudentTbl select 4 ,'月亮'select name,count(*) as 出现次数 from StudentTbl
group by name
having count(*)>1
drop table StudentTbl ------------------------
name 出现次数张三 2还有什么问题欢迎帖出来~