Subject Re: [ib-support] outer join query
Author Pirtea Calin Iancu
From: "Nick Upson"

> Either I've got a problem with my database or with my understanding of
outer
> joins.
>
> I expect the same number of rows from both of the queries below
> when there are no rows on the righthand side of the left outer join
> (b_matdet.b_md_worder_ref = b_order.b_o_ref fails)
>
> but the first one returns 1 row - fine and the second returns none.
>
> select * from b_matdet left outer join b_order on b_matdet.b_md_worder_ref
=
> b_order.b_o_ref
> where b_matdet.b_md_ref = 7023
>
> select * from b_matdet left outer join b_order on b_matdet.b_md_worder_ref
=
> b_order.b_o_ref
> inner join b_order_ops on b_order.b_o_ref = b_order_ops.b_o_ref
> where b_matdet.b_md_ref = 7023
>


if b_order_ops(b_o_ref) points to b_matdet then maybe your query should be:

select * from b_matdet left outer join b_order on b_matdet.b_md_worder_ref =
b_order.b_o_ref
inner join b_order_ops on b_order_ops.b_o_ref = b_matdet.b_md_worder_ref

in this case you get the same result as in your first query, provided you
have a
qualifying record in b_order_ops


Best regards,
Application Developer
Pirtea Calin Iancu
S.C. SoftScape S.R.L.
pcalin@...