Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



employee table has employee id ----------- empid ---------------- 1 2 3 3 3 4 5 5 5 6 ..

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

employee table has employee id ----------- empid ---------------- 1 2 3 3 3 4 5 5 5 6 ..

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

employee table has employee id ----------- empid ---------------- 1 2 3 3 3 4 5 5 5 6 ..

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

Post New Answer

More SQL Server Interview Questions

Explain the concepts and capabilities of sql server?

0 Answers  


What is user-defined function?

0 Answers  


Which virtual table does a trigger use?

8 Answers   TCS,


Which is the best place or learning center for MS SQL?????In Bangladesh?????

0 Answers   TCL, Wipro,


Can you explain important index characteristics?

0 Answers  


How optimize sql query with multiple joins in sql server?

0 Answers  


Explain the properties of a relational table?

0 Answers  


how to find number of columns in a table in sql server 2000 and 2005 also

7 Answers   HCL, Virtusa,


What are the essential components of sql server service broker?

0 Answers  


How to retrieve error messages using mssql_get_last_message()?

0 Answers  


What are the two authentication modes in sql server?

0 Answers  


What are policy management terms?

0 Answers  


Categories