Hi all,
i have a table as follows
empid empname mgrid deptid
1 a 3 4
2 b 1 5
3 c 2 3
4 d 3 6
5 e 4 7

i want the output as
empname mgrname
a c
b a
c b
d c
e d

Answer Posted / alok narayan

1.
select empname,(select empname from e1 b
where b.empid =a.mgrid) from e1 a;

2.
select a.empname empname,b.empname mgrname from e1 a,e1 b
where a.mgrid=b.empid order by a.empname ;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is partition used in sql?

558


how do you login to mysql using unix shell? : Sql dba

575


What does seeding a database mean?

536


Can two tables have same primary key?

537


what is bdb (berkeleydb)? : Sql dba

580






Write an sql query to select all records from the table?

565


What is an inner join sql?

551


What is multiple partition?

545


What are the features of pl sql?

571


What are different types of statements supported by sql?

617


Which column of the user triggers data dictionary view displays the database event that will fire the trigger?

600


What does select top 1 do in sql?

548


What is sql procedures and functions?

539


How can you load multi line records? : aql loader

665


What is the purpose of the primary key?

575