【发布时间】:2018-09-03 15:01:33
【问题描述】:
在执行以下查询以查找重复项时
select * from (
select a.* ,count (*) over (partition by a.ID) as tot
from HREMP a
) tt
where tt.tot >1
它返回 423 行,
我执行了另一个查询来查找不重复的记录
select * from (
select a.* ,count (*) over (partition by a.ID) as tot
from HREMP a
) tt
where tt.tot =1
返回 685 条记录
我发现 423 个重复项中有 196 个不同的记录 现在,如何从重复记录中选择第一条记录?
【问题讨论】:
-
如何判断哪个是第一条记录?按 HREMP_ID?
-
是的..@anonyXmous
标签: sql sql-server tsql duplicates