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 / goutam dey

select empname,salary from tableA
groupby empname
having count(empname)>1

Is This Answer Correct ?    3 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

why does a sql statement work correctly outside of a user-defined function, but incorrectly inside it? : Sql server administration

780


How to defragment table indexes?

699


What is the architecture of ms sql reporting service?

702


Define Unique Key?

761


Types of Authentications in Sql Server? How user gets authenticated through windows authentication?

756






Explain features and concepts of analysis services?

671


What are key, name and value columns of an attribute? : sql server analysis services, ssas

764


Can sql server 2016 run on windows 7?

678


What are different types of data sources?

646


What is stored in the mssqlsystemresource database? : sql server database administration

775


What is a hint?

736


What are various limitations of the views?

789


When multiple after triggers are attached to sql table, how to control the order of execution?

737


What do you understand by triggers?

685


What is the difference between dropping a database and taking a database offline?

905