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.
Answers were Sorted based on User's Feedback
Answer / vijendra singh shakya
For Employee table plz use the following Query...
select [empid] from employee group by [empid]
having count(empid)>1
Is This Answer Correct ? | 17 Yes | 0 No |
Answer / 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 |
Answer / rajesh kumar
select empid from employee where empid in (select empid
from employee group by empid having count(empid) > 1)
Is This Answer Correct ? | 0 Yes | 1 No |
How to select all columns of all rows from a table with a select statement in ms sql server?
How to create a simple user defined function in ms sql server?
in how many ways we can use count()
How much space does sql server 2016 take?
How to list all tables having unique constraints in any of the columns in a database.
What is a deadlock and what is a live lock? How will you go about resolving deadlocks?
how to insert the values in 5 table at a time Using any single statement ?
6 Answers Infosys, Value Labs,
How to enable tcp/ip protocol on a sql server?
What do you mean by authentication modes in sql server?
Explain what are partitioned views and distributed partitioned views?
how do u do Performance tunning ?
1 Answers Infodat Technologies, Satyam,
What is subquery in sql?