08 July 2016 Sudhanshu Ranjan 526
Display data which has two or more than two times in table in sql server.
This is very simple query that you can easily understand. How we are faching the data who has two or more than two times in table.
Here is Employee Table.
CREATE TABLE [dbo].[Employee]( [EmployeeId] [int] IDENTITY(1,1) NOT NULL, [EmployeeName] [varchar](50) NULL, [Salary] [int] NULL, [Gender] [varchar](50) NULL, [Address] [varchar](250) NULL, [RegistrationDate] [datetime] NULL, CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED ( [EmployeeId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO
We have some record in this table and there is some record which has duplicate.
SQL Script to get the record which has two or more than two times.
SELECT EmployeeName FROM Employee GROUP BY EmployeeName HAVING COUNT(*)>=2
Sudhanshu Kumar Ranjan | Lead Engineer at HCL Technologies | Expertise in Microsoft Technology | Author | Blogger | Programmer
Connect with him on Facebook | Google+ | LinkedIn | Twitter
- What is AngularJs?
- What is the difference between UNION and UNION ALL?
- What is Interface in C#? Explain
- Microsft online test question for Dotnet -1
- set default page while using “Area” in MVC application
- What is the Difference between Overriding and overloading
- AutoComplete Textbox in ASP.net MVC using Jquery.
- the webpage cannot be found http 404 error. Fixed!
- Factorial Number Program in C#
Leave a comment
Search In This Website
- Bind dropdown in MVC using jquery with C#
- Paging in MVC using C# with razor
- How to implement CAPTCHA in MVC 4 using C# Asp.net.
- How to use CKEditor in MVC application/ Asp.net application.
- Bind gridview and paging example in angularjs
- secure connection failed firefox fix
- TypeError: $(...).autocomplete is not a function
- How to install asp.net mvc 5 in visual studio 2012
- Code first approach with CRUD operation in MVC Application
- How to save data in database using MVC in asp.net
- Sql Server(8)
- Entity Framework(3)
- Angular Js(4)
- Web API(0)
- Web Service(1)
- Crystal Report(0)
- My SQL(5)
- Visual Studio(17)
- Knockout JS(0)
- Microsoft Office(0)
- Node JS(0)