Subject Re: Bug or feature (left join)
Author ainpoissee
--- In firebird-support@yahoogroups.com, "Arno Brinkman"
<fbsupport@...> wrote:
>
> With your reproducable case i see what's going on and firebird is
correct here.
> The LEFT JOIN TAB_Graafik will match 1 record for UID with value 2.
This record has '2006-09-20' in the Kuupaev field
> and thus with "(((TAB_Graafik.Kuupaev<='31.10.2006') AND
(TAB_Graafik.Kuupaev>='01.10.2006')) OR (TAB_Graafik.Kuupaev IS
> NULL))" it will be filtered out.
> What you want is indeed moving the filtering on Kuupaev into the ON
clause, because you want the records from
> TAB_Tooleping even if there are no records in TAB_Graafik for the
month oktober.

Makes sense... kind of.
IMHO the JOIN ON clause should be used only to define relation between
tables. The TAB_Graafik.Kuupaev field isn't part of the relation, it's
a part of the filter and thus belongs into WHERE. So in my head I
"compiled" it like "no matching TAB_Graafik.Kuupaev for given month so
it is NULL and OR(TAB_Graafik.Kuupaev IS NULL) takes care of it".
Do other (major) RDBs work like FB in such a case? Or is this modus
operandi even SQL standard?


ain