i want only duplicates rows from coloumn
ex. emp_id(colomn name)1,1,2,3,3,4,5,5.

so i want only duplicates no.

Answers were Sorted based on User's Feedback



i want only duplicates rows from coloumn ex. emp_id(colomn name)1,1,2,3,3,4,5,5. so i want only ..

Answer / kumar.t

Select Emp_Id, Count(Emp_Id) From Employee As Emp
Group By Emp_Id
Having Count(Emp_Id)>1


By
Kumar

Is This Answer Correct ?    17 Yes 2 No

i want only duplicates rows from coloumn ex. emp_id(colomn name)1,1,2,3,3,4,5,5. so i want only ..

Answer / chinna_g

You have 'emp' table with empid,empname,empsal.
With values:
1 row:1,'hhh',10000
2 row:2,'nnn',10000
3 row:3,'vvv',15000
4 row:4,'jjj',10000

A)
In this table you have sal column 10000 repeating 3 times
in the table, if you want to retrieve the repeated values
i.e. the salary column with 3 times to be displayed in the
following query:

"select empsal from emp where empsal in(select empsal from
emp group by empsal having count(empsal)>1);"

Is This Answer Correct ?    9 Yes 1 No

i want only duplicates rows from coloumn ex. emp_id(colomn name)1,1,2,3,3,4,5,5. so i want only ..

Answer / v rajkumar

select Emp_Id from Employee group by Emp_Id having count(*)
>1

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SQL Server Interview Questions

how to find 6th highest salary

0 Answers   Chetak Logistics,


What is co-related sub query?

0 Answers  


What are the advantages of using sql server over ms access or why should one use sql instead of ms access

2 Answers   CMS, Impetus,


What are the difference between data length and length in SQL Server-2008?

3 Answers   Scio Healthcare,


How can I check that whether automatic statistic update is enabled or not?

0 Answers  






How will you decide the active and passive nodes?

0 Answers  


Can a table be created inside a trigger?

0 Answers  


Some queries related to SQL

0 Answers   Motorola,


what is difference between Enterprise Manager and Query Analyer

6 Answers   CTS,


Explain indexed view?

1 Answers  


What is 3nf normalization?

0 Answers  


what are the Prerequisites for Replication?

1 Answers   IBM,


Categories