From: | <database(at)gurubase(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | hierarchy select question? |
Date: | 2000-07-31 19:15:40 |
Message-ID: | 965070940.3985d05c78eb5@mail.gurubase.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Dear all,
I would like to define threads in message system for replies to message but if
I define too many level, I am afraid I have problem in the select...
Say, I have define 3 levels:
1
/ \
2 3
/\ \
4 5 6
It means message 2 is a reply to 1.
4 is a further follow-up of 2...etc
In table format, I would present it with
Table A
ParentId ChildId
1 2
1 3
2 4
2 5
3 6
I think I can issue the command to join table A 3 times to give the following
result
1st 2nd 3rd
Row1 1 2 4
Row2 1 2 5
Row3 1 3 6
But can I show
a. which level each node belongs
b. no. of child nodes it has
altogether in one "select" sql
and if the level exceeds 3, how can I do it?
Many thanks.....
Best regards,
Boris
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2000-07-31 19:15:42 | Re: vacuum messges |
Previous Message | Herbert Liechti | 2000-07-31 19:10:51 | Re: How I can undelete recodes? |