Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
What's the right terminology for a nested/recursive relationship?
Post Flair (click to view more posts with a particular flair)
Post Body

Background: I'm a programmer that works pretty low on the stack. Assembly, PLC Ladder, etc. I know OO reasonably well, having done a decent bit of work in C-based languages.

I have a database of recipes. Each recipe has a number of inputs and outputs. Some inputs are raw materials, and some inputs are outputs from other recipes. Inputs and outputs can have arbitrary quantities attached to them.

What I'd like to be able to do is, for any recipe, traverse all nested recipes and resolve the sums of all raw materials required. It's assumed that there are no circular combinations possible.

I'd normally resolve this with an iterative approach in code, but I can't help but think there's an easier way to do this. Like one monster of a SQL statement. Trouble is, I don't really know what to Google for.

"Nested relationships" is turning up examples of the classic customer-order-product relationship. But my case is more like an order-order-order[...]-product relationship.

Can you suggest some terminology and further reading?

Author
Account Strength
100%
Account Age
13 years
Verified Email
Yes
Verified Flair
No
Total Karma
137,355
Link Karma
686
Comment Karma
135,826
Profile updated: 3 days ago
Posts updated: 4 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
5 years ago