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 / enis ertem

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

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

As a general practice, it is recommended to have dbo be the owner of all database objects however, in your database you find number of tables owned by a user other than dbo, how could you fix this?

624


What is the maximum length of an alert name?

609


What is difference between delete and truncate commands?

534


The external application that is executed in one of the tasks does not have a log file, but only a screen log. How can I save the data from the screen? : sql server management studio

529


How to list all tables in the database using odbc_tables()?

572






what method you can use to reduce the overhead of Reporting Services data sources?

153


What is purpose of normalization?

534


How will you hide an attribute? : sql server analysis services, ssas

530


How to write an inner join with the where clause in ms sql server?

560


What are system databases in ms sql server?

541


What is row-level compre?

549


When does a workload on SQL Azure get throttled?

113


Does dbcc checkdb requires db to be in single_user mode? : sql server database administration

525


Explain the categories of stored procedure?

525


What are various ways to enhance the ssrs report?

538