From: | "Andrej Ricnik-Bay" <andrej(dot)groups(at)gmail(dot)com> |
---|---|
To: | "Phillip Smith" <phillip(dot)smith(at)weatherbeeta(dot)com(dot)au> |
Cc: | "sql pgsql" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Extract interdependent info from one table |
Date: | 2008-01-25 23:05:47 |
Message-ID: | b35603930801251505t42f014aap8ae2b3d89bfe521f@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On 25/01/2008, Phillip Smith <phillip(dot)smith(at)weatherbeeta(dot)com(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Bryce Nesbitt | 2008-01-28 00:49:24 | Syntax question: use of join/using with fully qualified table name |
Previous Message | Marcin Krawczyk | 2008-01-25 19:53:12 | Re: age() function usage |