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
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 |
Answer / murtaza
select empname,salary from A
where empname IN ('A','B');
Is This Answer Correct ? | 3 Yes | 2 No |
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 |
Answer / zaheer abbas
select empname ,salary
from A
where salary <= 2000
order by empname
Is This Answer Correct ? | 6 Yes | 6 No |
Answer / rajkumar
select*from emp where empname in ('A','B') order by empname
Is This Answer Correct ? | 2 Yes | 2 No |
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 |
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 |
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 |
Answer / goutam dey
select empname,salary from tableA
groupby empname
having count(empname)>1
Is This Answer Correct ? | 3 Yes | 7 No |
Answer / inderpal
Select empname, salary from A order by empname
Is This Answer Correct ? | 1 Yes | 5 No |
What are the different sql server versions?
How do I save a stored procedure in sql server?
explain different types of cursors? : Sql server database administration
Explain the microsoft sql server delete command? : SQL Server Architecture
can anyone explain me the concept of Serialization in Detail and Clear? plz its urgent i have interview on friday (15th feb)
what is Buffer cash and Log Cache? Can you Explain it?
Hi Can any one tell me the Good institute to learn SQL esp for Data Base Testing or SQL from scratch to the proficiency level in Hyederabad and facult also. Thankyou well in advance
What is a DBMS, query, SQL?
What are the steps to insert a table?
What is field in algebra?
Can you please explain the difference between primary keys and foreign keys?
plz send every query in sql server2000