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.
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?
Subreddit
Post Details
- Posted
- 5 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/computersci...