Requery using result set from original query

  • Hi there,

    I am hoping that someone could offer me some advice on how to requery a resultset.

    I am attempting to write a query that will examine the availability of parts for fabrication. The problem is that each part is made of several sub-parts. I currently have a query that can check stock availability of the top level parts but I now need it to drill down beyond the top level to check the availability of the sub parts as well, basically going through several iterations of the same query until the lowest level of parts is reached.

    Is there a way I can take the results of the first run of the query and use the returned part id's to run it again?

    The code will take XML input from an ASP web app and pass all results back to the same app.

    Thanks!

  • Did you check common table expressions (CTE) ?

    This has recursive capacities.

    There are some nice examples at SSC, as well as performance articles regarding CTE and the alternatives.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • I had not used CTE's before but having now looked their recursive properties they do provide exactly what I needed.

    Many thanks. 🙂

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

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