Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: ANSI joins not working...

Re: ANSI joins not working...

From: David Portas <REMOVE_BEFORE_REPLYING_dportas_at_acm.org>
Date: 14 Jun 2005 08:21:54 -0700
Message-ID: <1118762514.711235.150380@f14g2000cwb.googlegroups.com>


> I'm wondering how yhour code:
>
> select p.PORTFOLIO_CODE, h.HOLDING_NUMBER_SHARES
> from PORTFOLIO_MASTER p left outer join PORTFOLIO_HOLDINGS h
> on p.PORTFOLIO_CODE = h.PORTFOLIO_CODE
> and h.INSTRUMENT_CODE = 'AFI'
>
> select p.PORTFOLIO_CODE, h.HOLDING_NUMBER_SHARES
> from PORTFOLIO_MASTER p full outer join PORTFOLIO_HOLDINGS h
> on p.PORTFOLIO_CODE = h.PORTFOLIO_CODE
> and h.INSTRUMENT_CODE = 'AFI'
>
> differs from the OPs original ANSI code:
>
> select p.PORTFOLIO_CODE, h.HOLDING_NUMBER_SHARES
> from PORTFOLIO_MASTER p left outer join PORTFOLIO_HOLDINGS h
> on p.PORTFOLIO_CODE = h.PORTFOLIO_CODE
> where h.INSTRUMENT_CODE = 'AFI'
>
> select p.PORTFOLIO_CODE, h.HOLDING_NUMBER_SHARES
> from PORTFOLIO_MASTER p full outer join PORTFOLIO_HOLDINGS h
> on p.PORTFOLIO_CODE = h.PORTFOLIO_CODE
> where h.INSTRUMENT_CODE = 'AFI'
>
> as I don't see a difference. This is the same code the OP is reporting
> as 'not working'

Not so. In his ANSI queries Peter referenced the unpreserved tables in the WHERE clause. So his queries are logically equivalent to an INNER join. My version moved that predicate to the ON clause, which makes a big diffrence to the meaning of the query.

--
David Portas
Received on Tue Jun 14 2005 - 10:21:54 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US