Hi,

I have a table A which has four rows as follows

Table A
-------

empname salary
------- ------
A 1000
B 2000
C 3000
A 1000
B 2000
D 5000

I need the following output:

empname salary
------- ------
A 1000
A 1000
B 2000
B 2000

Thanks in advance

Answer Posted / kuntal

select * from A where empname in (select empname from A
group by empname having COUNT(*)>1)

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I check if a view exists in a sql server database?

750


What is a transact-sql statement batch in ms sql server?

670


What happens when converting big values to numeric data types?

748


What is a partition key?

672


What is lookup override?

768






How can we solve concurrency problems?

775


How do I port a number to sql server?

697


Can you explain what is indexed view? How to create it?

717


Tell me what are the advantages of using stored procedures?

743


how to use DTS package in 2000,2005,2008 in sql server

1611


What is difference in performance between insert top (n) into table and using top with insert?

729


What is acid properties?

776


Why truncate is ddl command?

715


What is lock escalation? : sql server database administration

804


what is the different types of backups available in sql server? : Sql server database administration

645