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
What is dml with example?
Does truncate free space?
How do I run sql?
define sql update statement ? : Sql dba
Why does sql need a server?
what is the difference between mysql_fetch_array and mysql_fetch_object? : Sql dba
Is foreign key mandatory?
what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba
What is union and union all keyword in sql?
What is the primary key?
What is the sql query to display the current date?
Is vs as in pl sql?
Does pl/sql support create command?
If the application is running very slow? At what points you need to go about the database in order to improve the performance?
define data blocks ? : Sql dba