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

Explain different types of self contained sub query?

729


Can you change the data type of a column in a table after the table has been created? If so, which command would you use?

799


What are the purpose of Normalisation?

796


Is sql different from sql server?

688


explain the difference between oracle- sql and sql server sql ? if both are same y we r using 2 sw.s?

2185






What to check if a User database is locked?

768


Define outer join in sql server joins?

677


What is ms sql server service broker?

680


What is equi join with example?

719


What is tablesample?

762


What are actions, how many types of actions are there, explain with example? : sql server analysis services, ssas

735


What are triggers? How do you invoke a trigger on demand?

963


How can you append an identity column to a temporary table?

621


What is the difference between composite index and covering index?

683


What are the types of user defined functions in sql server?

715