Subject | Re: [firebird-support] Re: Old-style left join |
---|---|
Author | Chris M |
Post date | 2005-03-08T16:20:07Z |
ainpoissee wrote:
>can't you do cast(null as datatype) ?
> --- In firebird-support@yahoogroups.com, Kjell Rilbe
> <kjell.rilbe@a...> wrote:
>
>>>Outer joins cannot be written in the "old style". Only inner joins
>
> 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,
> NULL,NULL,NULL
> FROM RepToolepinguGraafik(2005, 3, 5)RTG
> 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
>