Duplicates

0

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

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 to main site
loading Hold tight while we fetch your results