SQL Query: Select duplicate records using group by and having clause

SQL Server Query: Select duplicate records using group by and having clause

This query is very important for Dotnet developers for facing SQL Server Interview Questions. If we have duplicate employee names in the employees table, we have to find out employee names who are having same names.

Below query will help in this regards,

SELECT [ename]
  FROM [Rajesh].[dbo].[employeeMaster] group by ename having COUNT(*)>1


Any other queries, please write in comments. 
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar