I have a table like this:
CREATE TABLE example ( id integer primary key, name char(200), parentid integer, value integer);
I can use the parentid field to organize the data in a tree structure.
Now here is a bit that I cannot solve. Given the parent, is it possible to write an SQL statement to compile all value fields under this parent and overwrite the tree branch?
UPDATE: I am using posgreSQL, so the fancy MS-SQL features are not available to me. In any case, I would like this to be seen as a general SQL question.
By the way, I am very impressed with the fact that I have 6 answers in 15 minutes with a question! Go to stack overflow!
sql postgresql recursive-query
Adam Pierce Sep 09 '08 at 23:08 2008-09-09 23:08
source share