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

What is the purpose of primary key?

749


what is uncommittable transactions? : Transact sql

752


What is sql trigger example?

751


How many sql are there?

733


What are the most important ddl statements in sql?

749






What is a composite primary key?

767


What is cursor and its types?

716


What does the base_object_type column shows in the user.triggers data dictionary view?

760


What are different types of sql commands?

698


What is clause?

793


What are the different schemas objects that can be created using pl/sql?

727


What is cte?

740


Where the sql database files are stored?

692


What is compute?

734


If the application is running very slow? At what points you need to go about the database in order to improve the performance?

751