Check Duplicate And Delete Duplicate Rows in sql server


We can remove duplicate values in sql server using table expression and row_number

Select WebAddress,COUNT(*) from dbo.CompanyInformation
group by WebAddress having COUNT(*)>1;
With CTS As
(
Select ROW_NUMBER()over(partition by Company order by Company)as Rowid,WebAddress
from dbo.CompanyInformation
)
 select * from CTS where WebAddress='www.oracle.com'
 --delete from CTS where Rowid >1;

Check Duplicate And Delete Duplicate Rows in sql server

Comments