employee table has employee id
-----------
empid
----------------
1
2
3
3
3
4
5
5
5
6
6
6
7
here the values r repeated two times.how to select the
repeated values only.i.e 3,5,6 should alone come.

Answer Posted / meher

If you want to get the count for the duplicates then, the
query will be:

SELECT EMPID,COUNT(EMPID) FROM EMPLOYEE GROUP BY EMPID
HAVING COUNT(EMPID)>1

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a trigger? Why we need it?

714


What is change data capture (cdc) feature?

805


As per your opinion what are the five top responsibilities of a dba? : sql server database administration

858


List some major differences between triggers and stored procedures?

717


Do you know exporting and importing utility?

718


Differentiate between sql temp table vs table variable?

686


SQL Server Architecture ?

2146


How to encrypt Strored Procedure in SQL SERVER?

801


What does the not null constraint do?

773


code to create procedure for taking databse backup in sql server or i have the query for it but what it's query returns means i want to show on my jsp that the databse backup has been taken on the basis of that return value.does it returns 0 or 1.wat is the code for that

1994


What are recommended options to be used while using db mirroring? : sql server database administration

797


How to select some specific columns from a table in a query in ms sql server?

748


What are the different Authentication modes in SQL Server and how can you change authentication mode?

840


How to concatenate two strings in SQL Server.

812


Explain about remote stored procedure?

793