Hello all,
I have a question.
I have a hierarchical structure like organisations. In that tree, I have a state attribute for each node.
If a node has a specific state (let say bar), all descending nodes should be the same state(bar).
Is it possible to identify and show the branches that do not match the state where an ancestor has bar?
CREATE TABLE orgs
(
id number,
pid number,
s varchar(10)
);
INSERT INTO orgs(id, pid, s) values(1, null, 'foo');
INSERT INTO orgs(id, pid, s) values(2, 1, 'foo');
INSERT INTO orgs(id, pid, s) values(3, 2, 'foo');
INSERT INTO orgs(id, pid, s) values(4, 3, 'foo');
INSERT INTO orgs(id, pid, s) values(10, null, 'foo');
INSERT INTO orgs(id, pid, s) values(11, 10, 'bar');
INSERT INTO orgs(id, pid, s) values(12, 11, 'foo');
INSERT INTO orgs(id, pid, s) values(13, 12, 'baz');
In first case, all good.
In second scenario, I'd like to show [11, bar] > [12, foo] > [13 > baz]
Because BAR is the state that when it is set on a node, all descendants should match it.
Is this possible easily?
Regards,