Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经使用下面的代码检索了重复项的数量及其出现次数
select empID, count(empID) AS DUPLICATEempID from employees group by empID having count (empID) > 1
我现在希望表包含返回的行数(即在返回的表上插入数字)
提前致谢。
在 SAS 中,您可以使用子查询来执行此操作:
select empId, DUPLICateempID, count(*) as NumDuplicates from (select empID, count(empID) AS DUPLICATEempID from employees group by empID having count (empID) > 1 ) t
当您有一个没有 a 的聚合函数时group by,它会将函数应用于整个表并重新合并结果。
group by