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

Explain differences between web edition and business edition?

109


When to use null data driven subscription?

170


what is memory-optimized nonclustered indexes

649


How are the unique and primary key constraints different?

689


Explain primary key and foreign key constraints?

596






Explain a checkpoint?

624


What is log shipping? Can we do logshipping with SQL Server 7.0 ?

656


Where do you find the default Index fill factor and how to change it?

684


How to execute a sql statement using odbc_exec()?

653


Explain transaction server explicit transaction?

597


What is the difference between TRUNCATE and DROP?

711


How to filter records of table in SQL SERVER?

687


What is importing utility?

635


What is the difference between a unique key and primary key?

586


How do I edit a stored procedure in sql server?

601