select Top 1 Owner,Domain,ID from table where ID in(select Distinct ID From table where 1=1 Group By(ID) Having count(ID)>1)
SELECT Owner,Domain,Id FROM ( SELECT Owner,Domain,Id,ROW_NUMBER() OVER(PARTITION BY Owner,Id ORDER BY ID ASC) ROWNUM FROM EmpDomain ) As A WHERE A.ROWNUM < 2 ORDER BY ID
select distinct o1.owner,o1.domain, o1.Id from owner o1 join owner o2 on o1.owner=o2.owner and o1.Id=o2.Id where o1.domain=(select top 1 domain from owner where id=o1.id and owner=o1.Owner)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)