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

Answers were Sorted based on User's Feedback



Hi, I have a table A which has four rows as follows Table A ------- empname salary ---..

Answer / 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

Hi, I have a table A which has four rows as follows Table A ------- empname salary ---..

Answer / murtaza

select empname,salary from A
where empname IN ('A','B');

Is This Answer Correct ?    3 Yes 2 No

Hi, I have a table A which has four rows as follows Table A ------- empname salary ---..

Answer / 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

Hi, I have a table A which has four rows as follows Table A ------- empname salary ---..

Answer / zaheer abbas

select empname ,salary
from A

where salary <= 2000
order by empname

Is This Answer Correct ?    6 Yes 6 No

Hi, I have a table A which has four rows as follows Table A ------- empname salary ---..

Answer / rajkumar

select*from emp where empname in ('A','B') order by empname

Is This Answer Correct ?    2 Yes 2 No

Hi, I have a table A which has four rows as follows Table A ------- empname salary ---..

Answer / vinay

select empname , salary
from A
where empname in (select name from A group by empname
having count(empname ) > 1)
order by empname

Is This Answer Correct ?    2 Yes 3 No

Hi, I have a table A which has four rows as follows Table A ------- empname salary ---..

Answer / anand

select empname,salary from tableA where(empname in (select
empname from tableA group by empname having count(empname)
>1))order by empname

Is This Answer Correct ?    0 Yes 1 No

Hi, I have a table A which has four rows as follows Table A ------- empname salary ---..

Answer / 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

Hi, I have a table A which has four rows as follows Table A ------- empname salary ---..

Answer / goutam dey

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

Is This Answer Correct ?    3 Yes 7 No

Hi, I have a table A which has four rows as follows Table A ------- empname salary ---..

Answer / inderpal

Select empname, salary from A order by empname

Is This Answer Correct ?    1 Yes 5 No

Post New Answer

More SQL Server Interview Questions

How do I view a trc file?

0 Answers  


How to filter out duplications in the returning rows in ms sql server?

0 Answers  


What is a materialized view?

3 Answers  


how many joins we can write if at all we have n no of tables

5 Answers   Tanla Solutions, TS,


What is the purpose of data source?

0 Answers  


how to determine the service pack currently installed on sql server? : Sql server database administration

0 Answers  


What is difference between views and tables?

0 Answers  


Can you explain what are various ways to enhance the ssrs report?

0 Answers  


What is the datatype returned by count(*)

22 Answers   247Customer, Asian CERC,


What are the system database in sql server 2008?

0 Answers  


What is merge replication?

0 Answers  


What command would you use to create an index?

0 Answers  


Categories