Subselects - recursion problem

From: Philip Rhoades <phil(at)chu(dot)com(dot)au>
To: pgsql-general(at)postgresql(dot)org
Subject: Subselects - recursion problem
Date: 2005-05-30 09:33:04
Message-ID: 1117445584.13881.9.camel@phil.chu.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)chu(dot)com(dot)au

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2005-05-30 09:42:57 Re: Subselects - recursion problem
Previous Message Zlatko Matic 2005-05-30 09:15:27 Re: Audit trail ?