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
How to start oracle sql developer?
How does sql*loader handles newline characters in a record? : aql loader
What is mutating table error?
What is primary key secondary key alternate key candidate key?
how would you get the current date in mysql? : Sql dba
When is the explicit cursor used ?
How many types of relationship are there?
What is data control language (dcl)?
What is the difference between view and stored procedure?
Why self join is used in sql?
Why stored procedure is better than query?
What is auto increment feature in sql?
What is the difference between rename and alias?
what are the differences between procedure-oriented languages and object-oriented languages? : Sql dba
What is parameter substitution in sql?