sql query for generating new coloumn

  • hi

    in my table i have employee id , employeename ,mangerid .

    now i want to retrive the data of manager name .when the employeeid equal to manger id .

    please help me

  • Regardless, it looks as if you want to create a list of employees and their managers.

    A simple direct way would be like this:

    Select E.EmployeeName, (select EmployeeName from employee where employeeID = E.ManagerID) as 'Manager' from employee E

    Hope that helps!

    This question should have been posted to the T-SQL or the NEWBIES list.

  • doug.williams (5/18/2011)


    Regardless, it looks as if you want to create a list of employees and their managers.

    A simple direct way would be like this:

    Select E.EmployeeName, (select EmployeeName from employee where employeeID = E.ManagerID) as 'Manager' from employee E

    Hope that helps!

    This question should have been posted to the T-SQL or the NEWBIES list.

    No necessary a simple solution. Especially if you need to whole tree of the organisation.

    BTW any problem is simple once you know how to solve it :hehe:.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply