Hi,
Oracle has a rather handy system for recursing through a table hierarchy.
To give an example, if we had a table representing Companies, with three
fields: company_id, parent_company_id and company_name, you could use the
following SQL to get all parents (and parent of parents, etc) of company_id
1234 like this:
select company_name from Company
connect by company_id = prior parent_company_id
start with company_id = 1234
(My sincere apologies if I'm teaching people to suck eggs - this is my
first post to the list, so for all I know you're all Oracle gurus!)
Is there any kind of function like this in PostgreSQL, or other way to
easily simulate it? I'm currently designing a database which will require a
certain amount of parent-child relationships, and whilst in Oracle I know
the SQL would be simple, I'm not sure how easy it will be without using
"connect by"...
Any help gratefully received!
Cheers,
Tim.