Results 1 to 3 of 3

Thread: Getting all childs recursively in query [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2004
    Location
    Jakarta, Indonesia
    Posts
    818

    Resolved Getting all childs recursively in query [RESOLVED]

    i have this 'manager like' table : ManagerID + Name + ParentID which it can have many descendants inside ex:

    1 + A + 0
    2 + B + 1
    3 + C + 2
    4 + D + 2
    5 + E + 1
    6 + F + 0
    7 + G + 6
    ...

    so when i want to get all childs for parent 1 it will return

    B - C - D then
    E without any childs

    any insight?

    PS: i'm using SQL SERVER 2005

    thanks,
    Last edited by erickwidya; Jan 20th, 2009 at 11:22 PM.

    1st NF - a table should not contain repeating groups.
    2nd NF - any fields that do not depend fully on the primary key should be moved to another table.
    3rd NF - there should be no dependency between non key fields in same table.
    - E. Petroutsos -


    eRiCk

    A collection of "Laku-abis" Ebook, Permanent Residence

    Access Reserved Words, a Classic Form Bug, Access Limitation, Know run Process and the Lock they hold in, Logging User Activity in MSSQL,
    Kill Database Processes

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