We have a BOM (Bill of material) table according below...
Now it has been found that the material included in itself in certain components and subcomponents. See below what I mean. This is not valid and makes some recursive SQL does not work.
My question is how through SQL can identify which materials are included in itself as a component. It may be a level 1 or 2 or less that they can be included.
Ex:
Material--------Component-------Quantity--------Materialtype
A---------------B---------------1---------------M
A---------------C---------------2---------------M
A---------------D---------------1---------------M
B---------------E---------------1---------------P
B---------------F---------------2---------------P
C---------------A---------------1---------------P --->Invalid
C---------------G---------------1---------------P
D---------------D---------------1---------------P --->Invalid
D---------------H---------------2---------------P
H---------------A---------------1---------------P --->Invalid
H---------------I---------------1---------------P
asked
06 Sep '16, 14:05
Rolle
558●49●51●61
accept rate:
0%
Please show us the details of your table (i.e. the CREATE TABLE statement - is it just one table?) and some insert statements with sample data and the queries you have tried so far...
What SQL Anywhere version do you use ("select @@version")?