Duplicates

0

Please login or register to vote for this query.

(click on this box to dismiss)

Physics

Q&A for active researchers, academics and students of physics

declare @T table
(
  id int,
  name varchar(10),
  roll int,
  class int
)

insert into @T values
 (1,'ram',1,2),
 (2,'shyam',2,3),
 (3,'ram',1,3),
 (4,'shyam',2,3),
 (5,'ram',1,2),
 (6,'hari',1,5)

select id, name, roll, class
from (select id, name, roll, class,
             count(*) over(partition by name, roll, class) as c
      from @T) as T
where c > 1
order by id

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results