in reply to (OT?) Recursive sql queries?

Which database system? Oracle (and PostgreSQL, kinda) handle tree structures without a problem. For example, in Oracle you could do the following (all on the SQL*Plus commandline):
CREATE TABLE FOO ( id NUMBER NOT NULL ,name VARCHAR2(20) ,parent NUMBER ); INSERT INTO FOO VALUES (1, 'First', NULL); INSERT INTO FOO VALUES (2, 'Second 1', 1); INSERT INTO FOO VALUES (3, 'Second 2', 1); INSERT INTO FOO VALUES (4, 'Third', 2); -- This is a formatting command COLUMN id a40; SELECT parent ,name ,LPAD(' ', 6*(Level - 1)) || id AS id FROM foo START WITH id = 1 CONNECT BY parent = PRIOR id;

I've tested the above, so you can actually just cut'n'paste it. The PG syntax is similar, but not identical, and you have to patch the latest release. (I don't remember where the patch can be downloaded from - google for it.)

Most other RDBMS do not have this kind of functionality built in. There are PL/SQL packages out there to handle this kind of structure, but they're very kludgy to use.

------
We are the carpenters and bricklayers of the Information Age.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.