Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Nested Recursive Query

$
0
0

I have a recursive query that gets me half way to where I need to be.   The only way I can see to get the result I need is to run that query recursively.

Is there a way to do this and then dump the results to a temp table and then when the query runs again to append those results to the same temp table etc. ?  Maybe with a Cursor and Fetch command?

My CTE fully expands a Bill Of Materials for an Item.  I can then gather up all the Estimated Time for each of those items that make up the full bill of materials and show a sum.  The idea is to see how much labour time will be required at any given work station for a "top level" item.  I have this working fine as a sub report.  

I need to find  a way to add up all the times for multiple "top level" items and show the sums by work station.   I don't think there is a way to do it from the data in the sub report since that runs independently. 

I can certainly provide a more detailed explanation - including examples and my CTE code - to anybody who has any bright ideas.

Thanks!

ts


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>