56,677
社区成员
发帖
与我相关
我的任务
分享
declare @t1 table (ID int,uname varchar(100))
insert into @t1
select 1,'A' UNION ALL
select 2,'A' UNION ALL
select 3,'B' UNION ALL
select 4,'A'
---以上为测试数据
SELECT *,COUNT(1) OVER(PARTITION BY uname) AS '重复次数'
FROM @t1
order by ID