Re: Extract interdependent info from one table - Mailing list pgsql-sql

From Andrej Ricnik-Bay
Subject Re: Extract interdependent info from one table
Date
Msg-id b35603930801251505t42f014aap8ae2b3d89bfe521f@mail.gmail.com
Whole thread Raw
In response to Re: Extract interdependent info from one table  ("Phillip Smith" <phillip.smith@weatherbeeta.com.au>)
List pgsql-sql
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_aliasin ('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


pgsql-sql by date:

Previous
From: "Marcin Krawczyk"
Date:
Subject: Re: age() function usage
Next
From: Bryce Nesbitt
Date:
Subject: Syntax question: use of join/using with fully qualified table name