Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: ANSI Outer Joins
Hi,
Simon Caldwell schrieb:
>
> Paul Moore wrote in message <364af9de.21722496_at_news.origin-it.com>...
> >On Thu, 12 Nov 1998 11:31:41 +0100, "Simon Caldwell"
> ><simonATgetrealsystemsDOTcom> wrote:
> >
> >>We have an application which runs on a number of other databases, and we
> now
> >>need to port to Oracle.
> >>
> >>The main problem we have, is that our SQL uses the ANSI standard SQL-92
> >>outer join syntax, which allows multi-table outer joins.
> >>I have looked on dejanews.com and can't find an answer to the problem,
> just
> >>discussion about levels of compliance with SQL-92.
> >>We need to be able to achieve the same affect as
> >>
> >>select a.col1, b.col2, c.col3
> >>from a, b, c
> >>where a.col1(+) = b.col1
> >> and a.col2(+) = c.col1
> >> and b.col4=c.col4
> >>
> >>which would be possible using SQL-92 syntax, which is supported by the
> other
> >>databases, but appears not to be using Oracle.
> >>
> >I don't understand your question. The syntax you quote works on
> >Oracle. If the syntax you are using is different, please post it...
> >
> >(Sorry, I don't know what SQL-92 looks like, so I can't say much abot
> >that without examples...)
> >
> >Paul Moore
> >
> No it doesn't. Note that A is outer joined to both B and C. This will give
> an error
> ORA-01416: two tables cannot be outer-joined to each other
>
> The SQL-92 syntax would be
> select a.col1, b.col2, c.col3
> from b
> JOIN c ON (b.col4=c.col4)
> LEFT OUTER JOIN a ON (a.col1 = b.col1 AND a.col2 = c.col1)
Maybe you should specify the version you use. With our NT 7.3.4.2.0 this works a few dozens times a day:
SELECT
a.NAME1, A.Vorname, A.Name2, A.Strasse, A.Ort, A.Postfach, A.Plz, o.Anzobj, m.anzMiet, k.anzki, S.anzsonst, A.AdressNummer, KB.ID FROM
Count(OBJEKTEIGENTUEMER.EIGENTUEMERNUMMER) AS Anzobj FROM OBJEKTEIGENTUEMER GROUP BY EIGENTUEMER ) o, (SELECT ADRESSNUMMER, Count(MIETER.GESUCHNUMMER) AS anzMietFROM MIETER GROUP BY Adressnummer ) M, (SELECT ADRESSNUMMER,
Regards
Matthias
--
Matthias.Gresz_at_Privat.Post.DE
Always log on the bright side of life.
http://www.stone-dead.asn.au/movies/life-of-brian/brian-31.htm
Received on Fri Nov 13 1998 - 07:07:48 CST