We have the following example table (actually taken from another example here on stackoverflow...)
CREATE TABLE example (
id integer primary key,
name char(200),
parentid integer,
value integer);
And given a specific child we want to get the top Parent.
I know of the tablefunc connectby function but that is for getting a parents children.
But, I'm interested in the other direction, given a child what is its top parent? What type of query would I try and use?
Any friendly advice is appreciated.