1. Welcome Guest! In order to create a new topic or reply to an existing one, you must register first. It is easy and free. Click here to sign up now!.
    Dismiss Notice

SQL - Querying on a hierarchy

Discussion in 'Microsoft News' started by NewsBot, Apr 30, 2008.

  1. NewsBot

    NewsBot I Got News

    Joined:
    Feb 8, 2006
    Messages:
    1,813
    Operating System:
    Windows Vista Home Premium
    Hello, I have a question about querying a hierarchy.

    Take This hypothetical table:
    <!--fonto:Courier New--> Courier New <!--/fonto-->
    EmpNo ** *Designation ** *ReportsTo
    10 ** *Director ** *
    20 ** *Senior Manager ** *10
    30 ** *Typist ** *** ** * 20
    40 ** *Programmer * ** ** 20

    And This One:

    JobNo** *Description** *EmpID
    10** ** * Make Tea** ** * 30
    20* ** ** Do Everything** 40
    30* ** ** Do Nothing** ** 20
    <!--fontc--><!--/fontc-->

    How would I go about querying all the way down the hierarchy?

    For example I want to see all of the jobs outstanding in Employee 10's team, no matter to whom they are assigned.

    How would I do that?



     

Share This Page