help with query

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: help with query
Date: 2001-01-23 18:11:49
Message-ID: Pine.GSO.4.31.0101232050410.12851-100000@ra.sai.msu.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

I have a table messages which has (for simplicity) two columns -
msg_id, last_id, where last_id is sort of symbolical link -
it points to the msg_id of the last version of message.
There are no limitation to the number of versions.
The problem I have is to get history of message with given
MSG_ID.

simple example - message with MSG_ID=1 has changed by editors
(1 - 2 - 3 ... 11) and last version has msg_id=11.
Data are shown only for this specific case, there are much more
data for different MSG_ID.

msg_id, last_id
---------------
11,
...
3,4
2,3
1,2

I need to get msg_id of all messages which parent is MSG_ID.
(hmm, probably I have to get this example as (parent, child)
example)

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

Browse pgsql-sql by date

  From Date Subject
Next Message David Wall 2001-01-23 18:58:22 blobs and small binary objects
Previous Message Tom Lane 2001-01-23 16:54:58 Re: select returns no line