From: Andrej Ricnik-Bay <andrej.groups@gmail.com>
To: Phillip Smith <phillip.smith@weatherbeeta.com.au>
Cc: sql pgsql <pgsql-sql@postgresql.org>
Subject: Re: Extract interdependent info from one table
Date: Sat, 26 Jan 2008 12:05:47 +1300
Message-ID: <b35603930801251505t42f014aap8ae2b3d89bfe521f@mail.gmail.com> (raw)
In-Reply-To: <010e01c85f08$5d52e570$9b0014ac@wbaus090>
References: <b35603930801241932j30499965i3d75229beb24e13e@mail.gmail.com>
<010e01c85f08$5d52e570$9b0014ac@wbaus090>
On 25/01/2008, Phillip Smith <phillip.smith@weatherbeeta.com.au> wrote:
> Absolutely clear as mud :P
sorry ... I'm not too good with expressing my SQL needs, I'm afraid,
Thanks for trying :}
In the end I got it sorted with the following
select
dm.docnum,
dm.alias1,
dm.docname,
dm.alias2 as "Status",
dm2.alias2 as "Reply"
from docmaster as dm
left outer join
( select
alias1,
subclass_alias,
alias2,
entrywhen
from docmaster
where subclass_alias in ('Reply','MinTR')
and alias2 in ('PENDING','COMPLETED')
) as dm2
on dm2.alias1 = dm.alias1
where dm.subclass_alias='Post'
and alias2 in ('PENDING','REDRAFT');
Cheers,
Andrej
--
Please don't top post, and don't use HTML e-Mail :} Make your quotes concise.
http://www.american.edu/econ/notes/htmlmail.htm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: andrej.groups@gmail.com, phillip.smith@weatherbeeta.com.au
Subject: Re: Extract interdependent info from one table
In-Reply-To: <b35603930801251505t42f014aap8ae2b3d89bfe521f@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox