Delete **all** duplicates

0

Please login or register to vote for this query.

(click on this box to dismiss)

Theoretical Computer Science

Q&A for theoretical computer scientists and researchers in related fields

declare @T table
(
  c1 int,
  c2 int
)

insert into @T values
(100,       1),
(100,       1),
(101,       2),
(101,       3),
(102,       4),
(102,       5),
(103,       6),
(104,       7),
(104,       7)

;with C as
(
  select *, count(*) over(partition by C1, C2) as D1,
         count(*) over(partition by C1) as D2
  from @T
)
select *
from C
where D1 = 1 and D2 = 2

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results