Subselects - recursion problem - Mailing list pgsql-general

From Philip Rhoades
Subject Subselects - recursion problem
Date
Msg-id 1117445584.13881.9.camel@phil.chu.com.au
Whole thread Raw
Responses Re: Subselects - recursion problem
Re: Subselects - recursion problem
List pgsql-general
People,

The following script works (I have confirmed it by doing two separate
views and doing a select on them) - but I don't understand why there
isn't a recursion problem with c1.policy and c2.policy - is there some
sort of trick happening?

Thanks,

Phil.


SELECT c1.loc, c1.lob, c1.policy
FROM crec
AS c1
WHERE c1.t_type = '1'
AND c1.t_diss = '2'
AND c1.recon = 'Y'
AND c1.policy = (   SELECT c2.policy
                    FROM crec
                    AS c2
                    WHERE c2.t_type = '1'
                    AND c2.t_diss = '0'
                    AND c2.recon = 'N'
                    AND c1.loc = c2.loc
                    AND c1.lob = c2.lob
                    AND c1.policy = c2.policy )
ORDER BY c1.loc, c1.lob, c1.policy ;



--
Philip Rhoades

Pricom Pty Limited  (ACN 003 252 275  ABN 91 003 252 275)
GPO Box 3411
Sydney NSW      2001
Australia
Mobile:  +61:0411-185-652
Fax:  +61:2:8923-5363
E-mail:  phil@chu.com.au



pgsql-general by date:

Previous
From: "Zlatko Matic"
Date:
Subject: Re: Audit trail ?
Next
From: Peter Eisentraut
Date:
Subject: Re: Subselects - recursion problem