Subject | Re: [firebird-support] Re: Old-style left join |
---|---|
Author | Martijn Tonies |
Post date | 2005-03-08T16:22:02Z |
> > > Outer joins cannot be written in the "old style". Only inner joins-> remove this > NULL,NULL,NULL
> can.
> >
> > Not quite true I believe. But outer joins require "union" queries. No
> > time to give any specifics right now - look it up!
>
> You mean something like
>
> SELECT
> RTG.Kuupaev,
> RTG.PaH,
> RTG.OhH,
> RTG.OoH,
> RTG.NormH,
> RTG.UusVah,
> RTG.VahPaevi,
> Vah.Nimi,
> Vah.AlgKell,
> CAST(RTG.Kuupaev + Vah.AlgKell+(Vah.Kestus/1440e0) AS TIME) AS LopKell
> FROM RepToolepinguGraafik(2005, 3, 5)RTG, TAB_Vahetus Vah
> WHERE(Vah.UID = RTG.Vahetus)
> UNION
> SELECT
> RTG.Kuupaev,
> RTG.PaH,
> RTG.OhH,
> RTG.OoH,
> RTG.NormH,
> RTG.UusVah,
> RTG.VahPaevi,
CAST(NULL as <type of Vah.Nimi>),
CAST(NULL as < type of Vah.AlgKell>),
CAST(NULL AS TIME)
> FROM RepToolepinguGraafik(2005, 3, 5)RTGWith regards,
> WHERE(RTG.Vahetus IS NULL)
>
> This raises "Data type unknown" error. If I remove 3 last fields
> (which are NULL in second query) it runs and seems to give result set
> I need... how to write second part of the union so it returns NULL for
> last 3 fielts?
> I'm using FB 1.5.0.429
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server
Upscene Productions
http://www.upscene.com