V
VJ
Folks,
I have the following 2 tables with the following data:-
1) BOMProduction
BomID, Item
bom-table, Table,1
bom-leg, Leg,1
bom-top, top,1
2) BomConsumption
BomID, Item, Qtyper
bom-table, Leg, 4
bom-table, top, 1
bom-leg, Wood,1
bom-top, Wood,1
As the name suggests, BOMProduction suggests the item being produced by the
BOMid and BOMConsumption tells what item is being consumed. So for ex: to
make a 'table', I consume 4 legs and 1 top.
Question:
---------
Is there any single SQL statement which takes the item being produced, an
iteratively loops to tell me the entire consumption pattern.. ie Table ->
Legs, Top -> Wood
ex: If I select 'Table', it should take the BOMId assciated with table ie
'bom-table' from BOMProduction. Now you search for this bomid in
bomConsumption and fetch the items 'Leg' and 'Top'. Now you find the
associated bomid for TOP in BOMProduction ie bom-top and search for consumed
item in bomconsumption in al oop. The exit criteria would be when the last
item found in BOMComsumption returns a NULL in BOMProduction ex: Wood
I know thre is a guru out there to help me with this statement
TIA,
Vijay
I have the following 2 tables with the following data:-
1) BOMProduction
BomID, Item
bom-table, Table,1
bom-leg, Leg,1
bom-top, top,1
2) BomConsumption
BomID, Item, Qtyper
bom-table, Leg, 4
bom-table, top, 1
bom-leg, Wood,1
bom-top, Wood,1
As the name suggests, BOMProduction suggests the item being produced by the
BOMid and BOMConsumption tells what item is being consumed. So for ex: to
make a 'table', I consume 4 legs and 1 top.
Question:
---------
Is there any single SQL statement which takes the item being produced, an
iteratively loops to tell me the entire consumption pattern.. ie Table ->
Legs, Top -> Wood
ex: If I select 'Table', it should take the BOMId assciated with table ie
'bom-table' from BOMProduction. Now you search for this bomid in
bomConsumption and fetch the items 'Leg' and 'Top'. Now you find the
associated bomid for TOP in BOMProduction ie bom-top and search for consumed
item in bomconsumption in al oop. The exit criteria would be when the last
item found in BOMComsumption returns a NULL in BOMProduction ex: Wood
I know thre is a guru out there to help me with this statement
TIA,
Vijay