Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 dml with example?

1065


Does truncate free space?

989


How do I run sql?

1148


define sql update statement ? : Sql dba

1099


Why does sql need a server?

1019


what is the difference between mysql_fetch_array and mysql_fetch_object? : Sql dba

1041


Is foreign key mandatory?

987


what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba

1021


What is union and union all keyword in sql?

1017


What is the primary key?

933


What is the sql query to display the current date?

1025


Is vs as in pl sql?

968


Does pl/sql support create command?

1086


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

976


define data blocks ? : Sql dba

968