Re: Chain/Thread Problem

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Chain/Thread Problem
Дата
Msg-id 200305161822.37391.dev@archonet.com
обсуждение исходный текст
Ответ на Chain/Thread Problem  (sammynash@uboot.com (Sammy))
Список pgsql-sql
On Friday 16 May 2003 3:46 pm, Sammy wrote:
> Hi,
>
> I have a SQL problem for you all. What SQL qurey would I have to make
> on the following table to extract the chain (thread) of emails in a
> conversation.
>
>
>          id|emailid|referenceid
>          -----------------------
>           1|  e125 |   Null             (Start of chain)
>           2|  r1fe |   e125             (2nd letter in chain)
>           ...
>           ...
>           n|  e4ju |   r1fe             (3rd in chain)

Search the archives for "connect by", "hierarchy", "nested" and "celko" - this
is a limitation of SQL. In your particular case, I'd add a SERIAL "thread_id"
column which is autogenerated for the first msg in a thread and set to the
first message for all others.

You might want to check the contrib/ directory, I've got a feeling there's an
example table-function to do something like this.
--  Richard Huxton


В списке pgsql-sql по дате отправления:

Предыдущее
От: "J Sensel"
Дата:
Сообщение: Re: Chain/Thread Problem
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Efficiency Issue with "SELECT IN (..)" and "SELECT .. OR .."