Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 list of rows with same column values

Author  Topic 

gagani
Posting Yak Master

112 Posts

Posted - 2014-11-03 : 06:05:59
select pr.birthdate, pr.operationdate from patientrecord pr
Total no.of rows = 24420

select distinct pr.birthdate, pr.operationdate from patientrecord pr
Total no.of rows = 23528

It seems there are some rows with same birthdate and operationdate.

I want to get the list of rows(with all columns) that has got same birthdate and operationdate

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2014-11-03 : 08:43:44
[code];with cte as
(
select *, row_number() over (partition by birthdate,operationdate order by operationdate) as RN
from YourTable
) select * from cte where RN > 1;[/code]
Go to Top of Page
   

- Advertisement -