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

Name the operator which is used in the query for pattern matching?

890


how do you login to mysql using unix shell? : Sql dba

1013


How do I save a stored procedure?

944


What is a mutating table and a constraining table?

1029


What is null in pl/sql?

1019


What is the difference between delete and truncate commands?

967


what is top in tsql? : Transact sql

1021


What is a table?

955


How do I filter in sql profiler?

947


What do you know by pl/sql cursors?

1033


what is column? : Sql dba

954


What are the differences between in and exists clause?

1047


Explain lock escalation? : Transact sql

1141


Can we use pl sql in mysql?

959


What is the usage of when clause in trigger?

987