Subject | Re: Bug or feature (left join) |
---|---|
Author | ainpoissee |
Post date | 2006-11-19T18:19:04Z |
--- In firebird-support@yahoogroups.com, "Arno Brinkman"
<fbsupport@...> wrote:
The WHERE clause consist of three parts: (A)AND(B)AND(C)
The first two, A and B, make sure that only records related to
particular month (oct 2006 in this case) are queried.
The third part is set of conditions and if any of those is met, record
should be included into result. The fact that TAB_Vahetus is LEFT
JOINed shouldn't be a problem as "unknown OR true" should return
"true", right?
ain
<fbsupport@...> wrote:
>'01.10.2006'))) AND
> Hi,
>
> > SELECT
> > DISTINCT
> > TAB_Tooleping.UID
> > FROM
> > TAB_Tooleping
> > JOIN TAB_Tootaja ON (TAB_Tootaja.UID = TAB_Tooleping.Tooline)
> > LEFT JOIN TAB_Graafik ON (TAB_Graafik.Tooleping = TAB_Tooleping.UID)
> > LEFT JOIN TAB_Vahetus ON (TAB_Vahetus.UID = TAB_Graafik.Vahetus)
> > WHERE
> > ((TAB_Tooleping.Alates <= '31.10.2006') AND
> > ((TAB_Tooleping.Kuni IS NULL) OR (TAB_Tooleping.Kuni >=
> > (((TAB_Graafik.Kuupaev <= '31.10.2006') AND (TAB_Graafik.Kuupaev'3') OR (TAB_Tooleping.Tooline =
>= '01.10.2006')) OR
> > (TAB_Graafik.Kuupaev IS NULL)) AND
> > ((TAB_Vahetus.Kestus > 480) OR (TAB_Tootaja.Isikukood STARTING
> > 1))on a LEFT JOIN part !!
> > ORDER BY
> > TAB_Tootaja.Perenimi ASC
>
> Note also in this query (TAB_Vahetus.Kestus > 480), because this is
> This could be the intention, but it's a little bit confusing.It is intentional. Why is it confusing?
The WHERE clause consist of three parts: (A)AND(B)AND(C)
The first two, A and B, make sure that only records related to
particular month (oct 2006 in this case) are queried.
The third part is set of conditions and if any of those is met, record
should be included into result. The fact that TAB_Vahetus is LEFT
JOINed shouldn't be a problem as "unknown OR true" should return
"true", right?
ain