Results 1 to 2 of 2

Thread: Recursive Query

  1. #1
    Join Date
    Mar 2002
    Posts
    192

    Unanswered: Recursive Query

    Does anyone know of a way to list all of the parts down all levels of a Bill of Material using a parameterized query. I was able to perform this task before by using recursive functions but would like to eliminate just queries as a possibility.

    GIVEN: tblPart


    ID PID
    1
    2 1
    3 1
    4 2
    5
    6 5


    If the query was run against ID 1 then the following records would be returned.


    1
    2 1
    3 1
    4 2

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Recursion is the only way to go here, in fact, this is the definition of a recursive requirement...

    There are ways to do this with just a query if you have a set maximum depth for your recursion, bit in manufacturing or other BOM environments, that usually isn't the case.

    There is a completely insane crosstab approach to doing this, but it's easier to do it as a function.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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