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
Name the operator which is used in the query for pattern matching?
how do you login to mysql using unix shell? : Sql dba
How do I save a stored procedure?
What is a mutating table and a constraining table?
What is null in pl/sql?
What is the difference between delete and truncate commands?
what is top in tsql? : Transact sql
What is a table?
How do I filter in sql profiler?
What do you know by pl/sql cursors?
what is column? : Sql dba
What are the differences between in and exists clause?
Explain lock escalation? : Transact sql
Can we use pl sql in mysql?
What is the usage of when clause in trigger?