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 |
I have Two table First have UserName and second is address, in address table more than value relegated to UserName table, i want to fetch 2nd address if exist other wise 1st address access
What do you think of this implementation? Can this be implemented better?
How can I get data from a database on another server?
How to skip remaining statements in a loop block using continue statements?
What are the different types of normalization?
What are 3 ways to get a count of the number of records in a table?
What is the optimal disk configuration for a database server and what raid configurations would you use if budget is not a constraint?
what changed between the previous version of sql server and the current version? : Sql server database administration
What is sql server 2000 work load governor?
Can we passed multiple recordset(set of records) using a Stored Procedure
What are the steps you must follow to hide sql server instances?
What are the steps to take to improve performance of a poor performing query? : sql server database administration
Oracle (3253)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)