CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 1999
    Posts
    16

    Find the EmployeeName and ManagerName


    How to list the Employee Name & respective Manager Name from the following table? Since Manager is also an Employee it is given in the same table

    EmpId MgrId EmpName
    001 100 Murali
    002 200 Raja
    100 1000 Vasanth
    200 2000 Bharath

    I want the SQL statement which gives the following result

    EmpName MgrName
    Murali Vasanth
    Raja Bharath


    muralirajan

  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Find the EmployeeName and ManagerName

    try this:
    select e.empid, e.empname, e2.empname 'Manager' from empl e
    inner join empl e2 on e.mgrid=e2.empid




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured