I searched the Internet and looked into my SQL books, but could not find the answer, so i hope someone here can help me!
I have a table like this (simplified):
For this table i need a 'exploded view' and an 'imploded view'.
Exploded view: all products that are decendants of the given product.
Imploded view: all ancestors (parents, grandparents and so on, up to and including a product with LevelCode=0).
Any SQL guru who can help me?
Thanks in advance
Ronald
I have a table like this (simplified):
Code:
CREATE TABLE Products (
ProductId COUNTER CONSTRAINT ProductsPK PRIMARY KEY,
ProductCode CHAR(8) NOT NULL,
ParentId LONG CONSTRAINT ProductFK1
REFERENCES Products (ProductId),
LevelCode BYTE);
Exploded view: all products that are decendants of the given product.
Imploded view: all ancestors (parents, grandparents and so on, up to and including a product with LevelCode=0).
Any SQL guru who can help me?
Thanks in advance
Ronald