Are the ancient Hindu myths of a land bridge connecting India and Sri Lanka true? Scientific analysis suggests they are. #WhatonEarth pic.twitter.com/EKcoGzlEET— Science Channel (@ScienceChannel) 11 December 2017
Dot net, Azure Cloud, Devops, Deployment, information,Interview Preparation,helping, Resume preparation
Wednesday, December 13, 2017
IS Ram Sethu is True ?
Monday, December 11, 2017
How to find duplicate records from sql server Table and Delete
How to find the duplicate record ?
Finding duplicate record from table using CTE.
WITH CTE
AS
(SELECT NAME,EMP_ID,ROW_NUMBER()
OVER(PARTITION BY NAME ORDER BY NAME)
AS NAMEDUP FROM EMPLOYEE)
SELECT * FROM CTE WHERE NAMEDUP > 1 ORDER BY NAME
Using Having Count
SELECT NAME,COUNT(NAME)FROM EMPLOYEE
GROUP BY NAME HAVING COUNT(*)>1
Using group by
SELECT NAME,COUNT(NAME) AS CNT
FROM EMPLOYEE
GROUP BY NAME
Deleting duplicate records from the table.
WITH CTE
AS
(SELECT NAME,EMP_ID,ROW_NUMBER()
OVER(PARTITION BY NAME ORDER BY NAME)
AS NAMEDUP FROM EMPLOYEE)
DELETE FROM CTE WHERE NAMEDUP > 1
Finding duplicate record from table using CTE.
WITH CTE
AS
(SELECT NAME,EMP_ID,ROW_NUMBER()
OVER(PARTITION BY NAME ORDER BY NAME)
AS NAMEDUP FROM EMPLOYEE)
SELECT * FROM CTE WHERE NAMEDUP > 1 ORDER BY NAME
Using Having Count
SELECT NAME,COUNT(NAME)FROM EMPLOYEE
GROUP BY NAME HAVING COUNT(*)>1
Using group by
SELECT NAME,COUNT(NAME) AS CNT
FROM EMPLOYEE
GROUP BY NAME
Deleting duplicate records from the table.
WITH CTE
AS
(SELECT NAME,EMP_ID,ROW_NUMBER()
OVER(PARTITION BY NAME ORDER BY NAME)
AS NAMEDUP FROM EMPLOYEE)
DELETE FROM CTE WHERE NAMEDUP > 1
Subscribe to:
Comments (Atom)
About Me
Blog Archive
-
▼
2025
(94)
-
▼
November
(8)
- ⭐ Top 50 .NET Interview Questions and Answers (Ful...
- 🧩 .NET Framework Monolithic to Microservices Conv...
- Angular vs ReactJS: A Complete Comparison for Mode...
- 🧩 Standalone vs Module in Angular: A Complete Gui...
- 🧩 Best Practices for Angular 16+ with .NET Core
- Python vs C# — An In-Depth Comparison
- 🧩 Façade Design Pattern in C# – Simplifying Compl...
- 🤖 Will AI Replace Software Developers? The Truth ...
-
▼
November
(8)