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 / 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 use truncate instead of delete?

1019


Define concurrency control. : Transact sql

1193


Which tcp/ip port does sql server run on? How can it be changed? : Sql dba

1007


What is difference between left and right outer join?

993


I need a function for a train ticket reservation please answer it thanks in advance

1032


How many types of relationship are there?

1031


Is trigger a stored procedure?

938


how to convert character strings to numeric values? : Sql dba

1112


What is nosql example?

1039


Explain how can you save or place your msg in a table?

1031


What is clause?

1158


What are the types of variable use in pl sql?

1086


How do I view tables in sql developer?

956


What is a delimiter in sas?

1059


What is sql entity?

1108