How to delete duplicate records in MSSQL Server?

 Here I have assumed that table name is Cars and Carid is primary key.

 

DELETE FROM CARS WHERE carId NOT IN (select MAX(carId)AS carId from Cars group by Model)
 
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2024 CodingFusion
50+ C# Programs for beginners to practice