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 / suresh babu

select t1.empname,t2.empname from emp t1,emp t2 where
t1.mgrid = t2.empid;

This query is self join,Which is display your requirement.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is pl sql used?

687


What are the indexing methods?

762


Is nosql faster than sql?

745


What is vector point function?

766


What is dbo in sql?

705






what is auto increment? : Sql dba

742


What is the purpose of using pl/sql?

828


How to read/write files from pl/sql?

772


How many functions are there in sql?

719


Can we create table inside stored procedure?

696


What are the steps for performance tuning.

1035


How to raise user-defined exception with custom sqlerrm ?

863


Does inner join remove duplicates?

699


Describe different types of general function used in sql?

727


what is a database transaction? : Sql dba

822