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 / mohit kumar singhal

Select emp.empname, emp.salary from emp right outer join (
select empname, salary from emp
group by empname, salary
having count(empname) > 1) as tbl
on emp.empname = tbl.empname

Is This Answer Correct ?    8 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are triggers? : Sql server database administration

572


Can two tables have the same primary key?

693


What happens on checkpoint?

690


What are the rules to use the rowguidcol property to define a globally unique identifier column?

678


Can truncate be rolled back?

617






Which tcl commands are available on the sql server?

679


What are the different type of replication in sql server?

633


Can two tables share the same primary key?

617


How to see the event list of an existing trigger using sys.trigger_events?

666


List out what other servers you can use with ssrs?

99


What is the main difference between ‘between’ and ‘in’ condition operators?

681


What is database isolation in sql server? : sql server database administration

657


Explain what is “asynchronous” communication in sql server service broker?

586


How many categories of functions based their return modes?

726


What is abstracting periodical?

607