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...

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

What are the different types of sql server replication? : sql server replication

1160


How to use clusters?

884


Can we perform backup restore operation on tempdb? : sql server database administration

947


Explain about unique identifier data type in sql server?

861


Define ACID properties in a Database?

1006


What is the difference between resultset and resultsetmetadata?

895


What is abstracting periodical?

897


In what sequence sql statement is processed?

957


How can we call UDF(User Define Function) using C# code in ASP.net ?

6802


What are the extra roles available in msdb? : sql server security

1078


What are the new features in sql server 2016?

930


Explain what is lock escalation and what is its purpose?

876


What are the different authentication modes in sql server? How can it be changed?

1026


What do you understand by recursive stored procedures?

941


Can you use order by when defining a view?

917