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 |
Explain forward - only cursors?
what purpose does OPENXML clause have in sql server stored procedure?
How to make a column nullable?
What are the dis_advantages of stored procedures, triggers, indexes?
How to reaname table name without using sp_Rename in sql server..?
What is field in algebra?
How to replace given values with null using nullif()?
Hi SQL gurus, i am working for an MNC... My team is having a problem in sql server. when user slects date prompts from jan 1st to april 30, it should display all months data like : jan aa feb bb mar cc but when it comes to april its taking data like : jan aa feb bb mar cc apr dd...and so on means its taking data again from jan to april which we dont want. we want the data only april month as we are getting jan, feb and mar... can any one write the code to relsove the issue please would be greatful if you can send to shiva_sans@yahoo.co.in and also please send your email also ...so that we will be in touch for any kind of queries ... Thanks a lot in Advance !!!
How do you Implement SSIS Packages in your Project?
tell me the disaster recovery plan
Hi all, I need query help for below senorio, could you please help me. TableName = City CITYID ContinuationID CITYNAME 1 1 SAN 1 2 DIEGO 2 1 SAN 2 2 FRANCISCO 3 1 CHICAGO 4 1 NEW 4 2 YORK 4 3 CITY Could you please help me to write a generalized SQL that returns results as given below in the Query result CITYID NAME1 NAME2 NAME3 NAME4 NAME5 1 SAN DIEGO 2 SAN FRANCISCO 3 CHICAGO 4 NEW YORK CITY
Tell me what is the significance of null value and why should we avoid permitting null values?
Oracle (3259)
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)