You are here: Re: How to display the managers and the employees working under that Manager « MsSQL Server « IT news, forums, messages
Re: How to display the managers and the employees working under that Manager

Posted by Ed Murphy on 09/08/06 08:56

broken arrow wrote:

> Ed Murphy wrote:
>> broken arrow wrote:
>>
>>> i have a table emp with employee id,name and mgrid
>>>
>>> I need to display the managers and the employee working under that
>>> manager . How should this be done.
>> Assuming you want the names of both, but don't care about IDs:
>>
>> select m.name, e.name
>> from emp m
>> join emp e on e.mgrid = m.employee_id
>> order by m.name

> But i need to display both id's and names then wht should i do

(Please don't top-post. Fixed.)

select m.employee_id, m.name, e.employee_id, e.name
from emp m
join emp e on e.mgrid = m.employee_id
order by m.name

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация